Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-02-04 23:07:49 +0300
committerJunio C Hamano <gitster@pobox.com>2021-02-05 04:16:42 +0300
commit8c29b497946fde2a6ef597d960a05d3dd36dcbf0 (patch)
tree56ced0369516976cf63d165e1f3fd2a790a15bcd /range-diff.c
parent66e871b6647ffea61a77a0f82c7ef3415f1ee79c (diff)
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>
Diffstat (limited to 'range-diff.c')
-rw-r--r--range-diff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/range-diff.c b/range-diff.c
index b9950f10c8..a4d7a90dde 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -97,6 +97,7 @@ static int read_patches(const char *range, struct string_list *list,
if (get_oid(p, &util->oid)) {
error(_("could not parse commit '%s'"), p);
free(util);
+ free(current_filename);
string_list_clear(list, 1);
strbuf_release(&buf);
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: "
"did not start with 'commit ': '%s'"),
line);
+ free(current_filename);
string_list_clear(list, 1);
strbuf_release(&buf);
strbuf_release(&contents);