summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-06-28 01:56:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:19:02 -0500
commit35a57320f881ee9ab6e5b49247eef99f2d984cf2 (patch)
tree8bbb60bdb9d9d207e91eb9a15cf7895645316e86 /source3/lib/util_str.c
parent8e274e8661cbd00fbfe72107a9e293ef8db2d70f (diff)
downloadsamba-35a57320f881ee9ab6e5b49247eef99f2d984cf2.tar.gz
samba-35a57320f881ee9ab6e5b49247eef99f2d984cf2.tar.bz2
samba-35a57320f881ee9ab6e5b49247eef99f2d984cf2.zip
r16595: Klocwork #2067. Fix possible memleak on error exit.
Jeremy. (This used to be commit 1d21a3dec9ea061ce900ad1223f7c2a43c064600)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c3
1 files changed, 3 insertions, 0 deletions
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;
}