From c26f11b67ff72c524e7e3fbf8fe96cc4607dfdc0 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Fri, 30 Oct 2015 14:42:52 +0100 Subject: [PATCH] str: explicitly deinitialize temporary value, instead of relying on talloc --- src/str.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/str.c b/src/str.c index 5682830d..1303ddf0 100644 --- a/src/str.c +++ b/src/str.c @@ -186,8 +186,11 @@ int str_replace_str(str_st *str, const str_rep_tab *tab) str->length -= final_len + ptab->pattern_length; if (ptab->rep_val) ret = str_append_str(str, ptab->rep_val); - else - ret = str_append_str(str, ptab->rep_func(str->pool, ptab->rep_func_input)); + else { + char *t = ptab->rep_func(str->pool, ptab->rep_func_input); + ret = str_append_str(str, t); + talloc_free(t); + } if (ret < 0) { talloc_free(final); return ret;