summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
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;
}