From 42c153e1c06fcfea8446f11bf3fc3bcf9ea25867 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 5 Sep 2024 12:09:01 +0200 Subject: remote: fix leak in reachability check of a remote-tracking ref In `check_if_includes_upstream()` we retrieve the local ref corresponding to a remote-tracking ref we want to check reachability for. We never free that local ref and thus cause a memory leak. Fix this. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- remote.c | 1 + 1 file changed, 1 insertion(+) (limited to 'remote.c') diff --git a/remote.c b/remote.c index 8d666c1641..e11b03a075 100644 --- a/remote.c +++ b/remote.c @@ -2731,6 +2731,7 @@ static void check_if_includes_upstream(struct ref *remote) if (is_reachable_in_reflog(local->name, remote) <= 0) remote->unreachable = 1; + free_one_ref(local); } static void apply_cas(struct push_cas_option *cas, -- cgit v1.3-5-g9baa