r16595: Klocwork #2067. Fix possible memleak on error exit.
authorJeremy Allison <jra@samba.org>
Wed, 28 Jun 2006 01:56:41 +0000 (01:56 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:19:02 +0000 (11:19 -0500)
Jeremy.
(This used to be commit 1d21a3dec9ea061ce900ad1223f7c2a43c064600)

source3/lib/util_str.c

index 8e0f2765ebb30c75380e61c580139ce2ce2fa5b7..938fb0f47b02121decdc696f23972768383bd792 100644 (file)
@@ -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;
 }