]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pull: plug minor memory leak after using is_descendant_of()
authorRené Scharfe <l.s.r@web.de>
Fri, 19 Jun 2020 13:14:19 +0000 (15:14 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jun 2020 19:17:21 +0000 (12:17 -0700)
cmd_pull() builds a commit_list to pass a single potential ancestor to
is_descendant_of().  The latter leaves the list intact.  Release the
allocated memory after the call.

Leaking in cmd_*() isn't a big deal, but sets a bad example for other
users of is_descendant_of().

Signed-off-by: René Scharfe <l.s.r@web.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pull.c

index 3e624d1e008588ed063a7a960026287d34b84965..06e5bd48b55623888706a0c41dd38162eb38230e 100644 (file)
@@ -994,6 +994,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
                                opt_ff = "--ff-only";
                                ret = run_merge();
                        }
+                       free_commit_list(list);
                }
                ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);