From 79d2351ce8acbd579081e558cdbaebe333e10153 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 27 Aug 2018 11:03:34 +0000 Subject: Memory leaks, from Gang Fan in GitHub issue 1453. --- format.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'format.c') diff --git a/format.c b/format.c index 54e33c7a..ec3839ef 100644 --- a/format.c +++ b/format.c @@ -1086,8 +1086,10 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, found = xstrdup(""); } } - if (format_choose(ptr + 1, &left, &right) != 0) + if (format_choose(ptr + 1, &left, &right) != 0) { + free(found); goto fail; + } if (format_true(found)) value = format_expand(ft, left); -- cgit