From 35a57320f881ee9ab6e5b49247eef99f2d984cf2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Jun 2006 01:56:41 +0000 Subject: r16595: Klocwork #2067. Fix possible memleak on error exit. Jeremy. (This used to be commit 1d21a3dec9ea061ce900ad1223f7c2a43c064600) --- source3/lib/util_str.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3') diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 8e0f2765eb..938fb0f47b 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -2402,6 +2402,9 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len, error: *len = -1; + if (mem_ctx == NULL) { + SAFE_FREE(*string); + } *string = NULL; } -- cgit