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>
This commit is contained in:
parent
66e871b664
commit
8c29b49794
@ -97,6 +97,7 @@ static int read_patches(const char *range, struct string_list *list,
|
|||||||
if (get_oid(p, &util->oid)) {
|
if (get_oid(p, &util->oid)) {
|
||||||
error(_("could not parse commit '%s'"), p);
|
error(_("could not parse commit '%s'"), p);
|
||||||
free(util);
|
free(util);
|
||||||
|
free(current_filename);
|
||||||
string_list_clear(list, 1);
|
string_list_clear(list, 1);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
strbuf_release(&contents);
|
strbuf_release(&contents);
|
||||||
@ -112,6 +113,7 @@ static int read_patches(const char *range, struct string_list *list,
|
|||||||
error(_("could not parse first line of `log` output: "
|
error(_("could not parse first line of `log` output: "
|
||||||
"did not start with 'commit ': '%s'"),
|
"did not start with 'commit ': '%s'"),
|
||||||
line);
|
line);
|
||||||
|
free(current_filename);
|
||||||
string_list_clear(list, 1);
|
string_list_clear(list, 1);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
strbuf_release(&contents);
|
strbuf_release(&contents);
|
||||||
|
Loading…
Reference in New Issue
Block a user