From 0f2df94c967b8464d4c9ff72f8e2a14f48db8bbe Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 4 Jul 2020 08:38:33 +0200 Subject: [PATCH] Fix memory leak introduced in commit e2039bc0694b89d26065899d9ed20f9bb42426f4 --- src/language/data-io/trim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/language/data-io/trim.c b/src/language/data-io/trim.c index 00ebcbbe67..b9983ef49e 100644 --- a/src/language/data-io/trim.c +++ b/src/language/data-io/trim.c @@ -303,7 +303,11 @@ parse_dict_keep (struct lexer *lexer, struct dictionary *dict) /* Delete the remaining variables. */ if (dict_get_var_cnt (dict) == nv) - return true; + { + free (v); + return true; + } + v = xnrealloc (v, dict_get_var_cnt (dict) - nv, sizeof *v); for (i = nv; i < dict_get_var_cnt (dict); i++) v[i - nv] = dict_get_var (dict, i); -- 2.30.2