vasprintf: return -1 on strdup failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2013-02-10 23:03:38 +01:00
parent b5fc51198b
commit 272d85cc85

View File

@ -33,7 +33,7 @@ int FAST_FUNC vasprintf(char **string_ptr, const char *format, va_list p)
if (r < 128) {
va_end(p2);
*string_ptr = strdup(buf);
return r;
return (*string_ptr ? r : -1);
}
*string_ptr = malloc(r+1);