range-diff: avoid leaking memory in two error code paths

In the code paths in question, we already release a lot of memory, but the `current_filename` variable was missed. Fix that. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Feb 4, 2021 at 20:07 UTC 8c29b497946fde2a6ef597d960a05d3dd36dcbf0
1 file changed +2
range-diff.c
+2
@@ -97,6 +97,7 @@ static int read_patches(const char *range, struct string_list *list,
97 if (get_oid(p, &util->oid)) {
98 error(_("could not parse commit '%s'"), p);
99 free(util);
100 + free(current_filename);
101 string_list_clear(list, 1);
102 strbuf_release(&buf);
103 strbuf_release(&contents);
@@ -112,6 +113,7 @@ static int read_patches(const char *range, struct string_list *list,
113 error(_("could not parse first line of `log` output: "
114 "did not start with 'commit ': '%s'"),
115 line);
116 + free(current_filename);
117 string_list_clear(list, 1);
118 strbuf_release(&buf);
119 strbuf_release(&contents);