Memory leaks, from Gang Fan in GitHub issue 1453.

This commit is contained in:
nicm
2018-08-27 11:03:34 +00:00
parent 1b4402c823
commit 79d2351ce8
4 changed files with 17 additions and 5 deletions

View File

@ -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);