vasprintf: return -1 on strdup failure
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
b5fc51198b
commit
272d85cc85
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user