summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2007-09-14 10:04:15 +1000
committerDarren Tucker <dtucker@zip.com.au>2007-09-14 10:04:15 +1000
commit84287b831ecbe105cea14294c8f5b058546ce801 (patch)
tree5ab544c7af4f5255c4f465b37a2099c646d58983
parent0eeaf127b522caa8e5d9924de7ee33af80a01a5d (diff)
- (dtucker) [openbsd-compat/bsd-asprintf.c] Plug mem leak in error path.
Patch from Jan.Pechanec at sun com.
-rw-r--r--ChangeLog6
-rw-r--r--openbsd-compat/bsd-asprintf.c1
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d92bff9..fa6eb1c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+20070914
+ - (dtucker) [openbsd-compat/bsd-asprintf.c] Plug mem leak in error path.
+ Patch from Jan.Pechanec at sun com.
+
20070910
- (dtucker) [openbsd-compat/regress/closefromtest.c] Bug #1358: Always
return 0 on successful test. From David.Leonard at quest com.
@@ -3190,4 +3194,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@
-$Id: ChangeLog,v 1.4741 2007/09/10 23:24:17 tim Exp $
+$Id: ChangeLog,v 1.4742 2007/09/14 00:04:15 dtucker Exp $
diff --git a/openbsd-compat/bsd-asprintf.c b/openbsd-compat/bsd-asprintf.c
index 00fa0dfd..3368195d 100644
--- a/openbsd-compat/bsd-asprintf.c
+++ b/openbsd-compat/bsd-asprintf.c
@@ -55,6 +55,7 @@ vasprintf(char **str, const char *fmt, va_list ap)
if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */
*str = string;
} else if (ret == INT_MAX || ret < 0) { /* Bad length */
+ free(string);
goto fail;
} else { /* bigger than initial, realloc allowing for nul */
len = (size_t)ret + 1;