From 84287b831ecbe105cea14294c8f5b058546ce801 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 14 Sep 2007 10:04:15 +1000 Subject: - (dtucker) [openbsd-compat/bsd-asprintf.c] Plug mem leak in error path. Patch from Jan.Pechanec at sun com. --- openbsd-compat/bsd-asprintf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsd-compat/bsd-asprintf.c') 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) 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; -- cgit v1.2.3