fix valgrind problems

This commit is contained in:
josch
2014-10-19 08:58:56 +02:00
parent f23250aaef
commit 5a673abd1b
3 changed files with 67 additions and 7 deletions

View File

@@ -42,6 +42,10 @@ char *strdup_printf(char *fmt, ...)
bytes_to_allocate++;
ret_str = (char *)malloc(bytes_to_allocate * sizeof(char));
if (ret_str == NULL) {
fprintf(stderr, "failed to allocate memory\n");
return NULL;
}
va_start(ap, fmt);
bytes_to_allocate = vsnprintf(ret_str, bytes_to_allocate, fmt, ap);