summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fvwrite.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-11-30 01:13:24 +0000
committermillert <millert@openbsd.org>1997-11-30 01:13:24 +0000
commit3232a7f5aac5123b6bbed99b2a01d57306bd673c (patch)
tree8fe95f874b90fc1e05460d6a4cc285c79b70b11c /lib/libc/stdio/fvwrite.c
parentFix setting of crtscts. It was not being set in set_up_tty() if the (diff)
downloadwireguard-openbsd-3232a7f5aac5123b6bbed99b2a01d57306bd673c.tar.xz
wireguard-openbsd-3232a7f5aac5123b6bbed99b2a01d57306bd673c.zip
Deal with realloc() failure in v?asprintf()
Diffstat (limited to 'lib/libc/stdio/fvwrite.c')
-rw-r--r--lib/libc/stdio/fvwrite.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c
index c01968b72f8..bc73dbb8743 100644
--- a/lib/libc/stdio/fvwrite.c
+++ b/lib/libc/stdio/fvwrite.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: fvwrite.c,v 1.5 1997/11/29 19:54:48 millert Exp $";
+static char rcsid[] = "$OpenBSD: fvwrite.c,v 1.6 1997/11/30 01:13:24 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -120,9 +120,10 @@ __sfvwrite(fp, uio)
*/
fp->_w = len + 128;
fp->_bf._size = blen + len + 128;
- /* XXX - check return val */
fp->_bf._base =
realloc(fp->_bf._base, fp->_bf._size + 1);
+ if (fp->_bf._base == NULL)
+ goto err;
fp->_p = fp->_bf._base + blen;
}
w = fp->_w;