diff options
| author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-09-26 08:26:16 +0000 |
|---|---|---|
| committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-09-26 08:26:16 +0000 |
| commit | 23b6f7902dab3d485f047b6b6cf1f5058484a8e3 (patch) | |
| tree | 76aba0569af51b16ed123e1a44824456ffadecdb /lib/libc/stdio/vswprintf.c | |
| parent | 3383deca89b096faaebf065ba1a4be55ea1b46f4 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/vswprintf.c')
| -rw-r--r-- | lib/libc/stdio/vswprintf.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libc/stdio/vswprintf.c b/lib/libc/stdio/vswprintf.c index da5c4c25f7a3..3ea1b4ca781c 100644 --- a/lib/libc/stdio/vswprintf.c +++ b/lib/libc/stdio/vswprintf.c @@ -48,7 +48,7 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, mbstate_t mbs; char *mbp; size_t mbresult; - int ret; + int ret, sverrno; if (n == 0) { errno = EINVAL; @@ -66,6 +66,12 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, f._extra = &ext; INITEXTRA(&f); ret = __vfwprintf(&f, fmt, ap); + if (ret < 0) { + sverrno = errno; + free(f._bf._base); + errno = sverrno; + return (-1); + } *f._p = '\0'; mbp = f._bf._base; memset(&mbs, 0, sizeof(mbs)); |
