summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorAndré Goddard Rosa <andre.goddard@gmail.com>2010-01-30 22:40:45 -0200
committerJean-Baptiste Queru <jbq@google.com>2010-04-29 07:33:40 -0700
commitc8a850bcd174acf43f951b5b70783cb636418b53 (patch)
tree62f931c9e8a683417384825b2f33fb01045ab13c /libc
parent6aed4288eba64f8265b98d34fdfd0bc0cd76151d (diff)
downloadbionic-c8a850bcd174acf43f951b5b70783cb636418b53.zip
bionic-c8a850bcd174acf43f951b5b70783cb636418b53.tar.gz
bionic-c8a850bcd174acf43f951b5b70783cb636418b53.tar.bz2
stdio: simplify vasprintf()
... 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
Diffstat (limited to 'libc')
-rw-r--r--libc/stdio/vasprintf.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c
index c3280c9..54c46b3 100644
--- a/libc/stdio/vasprintf.c
+++ b/libc/stdio/vasprintf.c
@@ -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);