summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/asprintf.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2001-09-05 22:32:27 +0000
committerderaadt <deraadt@openbsd.org>2001-09-05 22:32:27 +0000
commit24766c5400032a2369be118d2414a7986b46bee0 (patch)
tree8a4a6c3337382440d16aeab559efaa74df34c5e7 /lib/libc/stdio/asprintf.c
parentsparc64 uses new binutils. (diff)
downloadwireguard-openbsd-24766c5400032a2369be118d2414a7986b46bee0.tar.xz
wireguard-openbsd-24766c5400032a2369be118d2414a7986b46bee0.zip
make sure that va_start() has matching va_end()
Diffstat (limited to 'lib/libc/stdio/asprintf.c')
-rw-r--r--lib/libc/stdio/asprintf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c
index fd0ba320c8f..f08e6c96f42 100644
--- a/lib/libc/stdio/asprintf.c
+++ b/lib/libc/stdio/asprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asprintf.c,v 1.6 1998/10/16 16:11:55 millert Exp $ */
+/* $OpenBSD: asprintf.c,v 1.7 2001/09/05 22:32:33 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: asprintf.c,v 1.6 1998/10/16 16:11:55 millert Exp $";
+static char rcsid[] = "$OpenBSD: asprintf.c,v 1.7 2001/09/05 22:32:33 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -70,14 +70,15 @@ asprintf(str, fmt, va_alist)
if (ret == -1)
goto err;
*f._p = '\0';
- va_end(ap);
_base = realloc(f._bf._base, ret + 1);
if (_base == NULL)
goto err;
*str = (char *)_base;
+ va_end(ap);
return (ret);
err:
+ va_end(ap);
if (f._bf._base) {
free(f._bf._base);
f._bf._base = NULL;