]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/commitdiff
stdio: simplify vasprintf()
authorAndré Goddard Rosa <andre.goddard@gmail.com>
Sun, 31 Jan 2010 00:40:45 +0000 (22:40 -0200)
committerJean-Baptiste Queru <jbq@google.com>
Thu, 29 Apr 2010 14:33:40 +0000 (07:33 -0700)
... by removing unneeded NULL check, as free() already does it.
By the way, we don't need to set a stack variable back to NULL.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Change-Id: Id90eb8f042b5c922c5ff139b11ff8366fb404566

libc/stdio/vasprintf.c

index c3280c9fcd3bf9f167e536093771bdd8bdcf4dd6..54c46b3db78dc24eb677aea9d219c91b5d1f18db 100644 (file)
@@ -48,10 +48,7 @@ vasprintf(char **str, const char *fmt, __va_list ap)
        return (ret);
 
 err:
-       if (f._bf._base) {
-               free(f._bf._base);
-               f._bf._base = NULL;
-       }
+       free(f._bf._base);
        *str = NULL;
        errno = ENOMEM;
        return (-1);