Browse code

strdup freed with qm_free fixed -- Jan, the malloc fixer

Jan Janak authored on 20/03/2003 00:52:25
Showing 1 changed files
... ...
@@ -351,7 +351,10 @@ static char* addstr(char * src, char ** dest)
351 351
 	unsigned len1, len2;
352 352
 	
353 353
 	if (*dest==0){
354
-		*dest=strdup(src);
354
+		len1 = strlen(src);
355
+		*dest = pkg_malloc(len1 + 1);
356
+		if (*dest == 0) goto error;
357
+		memcpy(*dest, src, len1 + 1);
355 358
 	}else{
356 359
 		len1=strlen(*dest);
357 360
 		len2=strlen(src);