summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/sprintf.c
diff options
context:
space:
mode:
authorassar <assar@FreeBSD.org>2001-06-16 05:37:57 +0000
committerassar <assar@FreeBSD.org>2001-06-16 05:37:57 +0000
commit41adf21f1fde09a07054cd9daa096b7212ab2b7c (patch)
treec479adcc4560640387994dc0dba749ed8a0d5732 /lib/libc/stdio/sprintf.c
parent81a67b96b997f71f3a5e1ed70c12b32e4d9fd86c (diff)
downloadFreeBSD-src-41adf21f1fde09a07054cd9daa096b7212ab2b7c.zip
FreeBSD-src-41adf21f1fde09a07054cd9daa096b7212ab2b7c.tar.gz
free memory that gets allocated by vfprintf when str == NULL
PR: misc/26044 MFC after: 1 week
Diffstat (limited to 'lib/libc/stdio/sprintf.c')
-rw-r--r--lib/libc/stdio/sprintf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libc/stdio/sprintf.c b/lib/libc/stdio/sprintf.c
index a810096..04910e0 100644
--- a/lib/libc/stdio/sprintf.c
+++ b/lib/libc/stdio/sprintf.c
@@ -77,5 +77,7 @@ sprintf(str, fmt, va_alist)
ret = __vfprintf(&f, fmt, ap);
va_end(ap);
*f._p = 0;
+ if (str == NULL)
+ free(f._bf._base);
return (ret);
}
OpenPOWER on IntegriCloud