summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-09-05 22:32:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-09-05 22:32:47 +0000
commit772191eebf6a62b3fe9de2482c910de8c79000d5 (patch)
treeeea109f48afccf4e7cab1ea695e65fec36d1cf5e /lib/libc/stdio
parenta30f0def118756a387cba2c5eac41a702277da77 (diff)
make sure that va_start() has matching va_end()
Diffstat (limited to 'lib/libc/stdio')
-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;