vasprintf: return -1 on strdup failure
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 10 Feb 2013 22:03:38 +0000 (23:03 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 10 Feb 2013 22:03:38 +0000 (23:03 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/platform.c

index d241d25a7679d4bb89efc2b7ee5b013e1c74620b..19734517b13bddfc7c606301019e2f93ae9ffb5d 100644 (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);