From c8a850bcd174acf43f951b5b70783cb636418b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Sat, 30 Jan 2010 22:40:45 -0200 Subject: [PATCH] stdio: simplify vasprintf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... 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 Change-Id: Id90eb8f042b5c922c5ff139b11ff8366fb404566 --- libc/stdio/vasprintf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c index c3280c9fc..54c46b3db 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);