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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cdbb7208c8
commit
42c153e1c0
1
remote.c
1
remote.c
@ -2731,6 +2731,7 @@ static void check_if_includes_upstream(struct ref *remote)
|
|||||||
|
|
||||||
if (is_reachable_in_reflog(local->name, remote) <= 0)
|
if (is_reachable_in_reflog(local->name, remote) <= 0)
|
||||||
remote->unreachable = 1;
|
remote->unreachable = 1;
|
||||||
|
free_one_ref(local);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apply_cas(struct push_cas_option *cas,
|
static void apply_cas(struct push_cas_option *cas,
|
||||||
|
@ -5,6 +5,7 @@ test_description='compare & swap push force/delete safety'
|
|||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
setup_srcdst_basic () {
|
setup_srcdst_basic () {
|
||||||
|
Reference in New Issue
Block a user