summaryrefslogtreecommitdiff
path: root/openbsd-compat
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 /openbsd-compat
parent0eeaf127b522caa8e5d9924de7ee33af80a01a5d (diff)
- (dtucker) [openbsd-compat/bsd-asprintf.c] Plug mem leak in error path.
Patch from Jan.Pechanec at sun com.
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/bsd-asprintf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/openbsd-compat/bsd-asprintf.c b/openbsd-compat/bsd-asprintf.c
index 00fa0dfd8..3368195d4 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)
55 if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */ 55 if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */
56 *str = string; 56 *str = string;
57 } else if (ret == INT_MAX || ret < 0) { /* Bad length */ 57 } else if (ret == INT_MAX || ret < 0) { /* Bad length */
58 free(string);
58 goto fail; 59 goto fail;
59 } else { /* bigger than initial, realloc allowing for nul */ 60 } else { /* bigger than initial, realloc allowing for nul */
60 len = (size_t)ret + 1; 61 len = (size_t)ret + 1;