summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vswprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/vswprintf.c')
-rw-r--r--lib/libc/stdio/vswprintf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/stdio/vswprintf.c b/lib/libc/stdio/vswprintf.c
index 023c537..4b1e382 100644
--- a/lib/libc/stdio/vswprintf.c
+++ b/lib/libc/stdio/vswprintf.c
@@ -66,6 +66,7 @@ vswprintf_l(wchar_t * __restrict s, size_t n, locale_t locale,
f._bf._base = f._p = (unsigned char *)malloc(128);
if (f._bf._base == NULL) {
errno = ENOMEM;
+ *s = L'\0';
return (-1);
}
f._bf._size = f._w = 127; /* Leave room for the NUL */
@@ -74,6 +75,7 @@ vswprintf_l(wchar_t * __restrict s, size_t n, locale_t locale,
sverrno = errno;
free(f._bf._base);
errno = sverrno;
+ *s = L'\0';
return (-1);
}
*f._p = '\0';
@@ -87,6 +89,7 @@ vswprintf_l(wchar_t * __restrict s, size_t n, locale_t locale,
free(f._bf._base);
if (nwc == (size_t)-1) {
errno = EILSEQ;
+ *s = L'\0';
return (-1);
}
if (nwc == n) {
OpenPOWER on IntegriCloud