Skip to content

Commit 1e8cb17

Browse files
pks-tgitster
authored andcommitted
builtin/submodule--helper: fix leaking refs on push-check
In the push-check subcommand of the submodule helper we acquire a list of local refs, but never free that list. Fix this memory leak. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3eefd34 commit 1e8cb17

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

builtin/submodule--helper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,7 +2958,9 @@ static int push_check(int argc, const char **argv, const char *prefix UNUSED)
29582958
rs->src);
29592959
}
29602960
}
2961+
29612962
refspec_clear(&refspec);
2963+
free_refs(local_refs);
29622964
}
29632965
free(head);
29642966

t/t5531-deep-submodule-push.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
88
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
99
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
1010

11+
TEST_PASSES_SANITIZE_LEAK=true
1112
. ./test-lib.sh
1213

1314
test_expect_success setup '

0 commit comments

Comments
 (0)