summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 826ea28..8ca5ac4 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -384,9 +384,11 @@ __wcsconv(wchar_t *wcsarg, int prec)
break;
mbp += clen;
}
- *mbp = '\0';
- if (clen == (size_t)-1)
+ if (clen == (size_t)-1) {
+ free(convbuf);
return (NULL);
+ }
+ *mbp = '\0';
return (convbuf);
}
OpenPOWER on IntegriCloud