diff --git a/commit-reach.c b/commit-reach.c index 4ca7e706a1..6bba16e7b5 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -396,6 +396,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 @@ -417,7 +418,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; } /*