diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-09-05 12:09:17 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-05 08:49:12 -0700 |
| commit | 16c6fb5a94231e76f618eefc7a683fd12091968a (patch) | |
| tree | d48b6fc0c1be469a03ce7de31258a620289e0ae7 | |
| parent | 14c0ea0f6f7a0898214d8fa822a2392ef3a00f53 (diff) | |
| download | git-16c6fb5a94231e76f618eefc7a683fd12091968a.tar.gz | |
shallow: fix leaking members of `struct shallow_info`
We do not free several struct members in `clear_shallow_info()`. Fix
this to plug the resulting leaks.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | shallow.c | 9 | ||||
| -rwxr-xr-x | t/t5538-push-shallow.sh | 1 |
2 files changed, 10 insertions, 0 deletions
@@ -489,6 +489,15 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa) void clear_shallow_info(struct shallow_info *info) { + if (info->used_shallow) { + for (size_t i = 0; i < info->shallow->nr; i++) + free(info->used_shallow[i]); + free(info->used_shallow); + } + + free(info->need_reachability_test); + free(info->reachable); + free(info->shallow_ref); free(info->ours); free(info->theirs); } diff --git a/t/t5538-push-shallow.sh b/t/t5538-push-shallow.sh index e91fcc173e..6adc3a20a4 100755 --- a/t/t5538-push-shallow.sh +++ b/t/t5538-push-shallow.sh @@ -5,6 +5,7 @@ test_description='push from/to a shallow clone' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh commit() { |
