summaryrefslogtreecommitdiff
path: root/commit-reach.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-06-29 21:17:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-06-29 21:17:27 (GMT)
commitfa2c57d562921cdd3be5c7af1ee59622439bc8cd (patch)
tree0ca025de5f8b7060eeae500eb5bd559d75b94bc9 /commit-reach.c
parentb381c98891c90c198b247b970bae783123226cad (diff)
parentd546fe2874ce8dc73cb0ac7541640fd202ec27c8 (diff)
downloadgit-fa2c57d562921cdd3be5c7af1ee59622439bc8cd.zip
git-fa2c57d562921cdd3be5c7af1ee59622439bc8cd.tar.gz
git-fa2c57d562921cdd3be5c7af1ee59622439bc8cd.tar.bz2
Merge branch 'rs/commit-reach-leakfix'
Leakfix. * rs/commit-reach-leakfix: commit-reach: plug minor memory leak after using is_descendant_of()
Diffstat (limited to 'commit-reach.c')
-rw-r--r--commit-reach.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/commit-reach.c b/commit-reach.c
index 43e303d..1761217 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -411,6 +411,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
struct object *o;
struct commit *old_commit, *new_commit;
struct commit_list *old_commit_list = NULL;
+ int ret;
/*
* Both new_commit and old_commit must be commit-ish and new_commit is descendant of
@@ -432,7 +433,9 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
return 0;
commit_list_insert(old_commit, &old_commit_list);
- return is_descendant_of(new_commit, old_commit_list);
+ ret = is_descendant_of(new_commit, old_commit_list);
+ free_commit_list(old_commit_list);
+ return ret;
}
/*