diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-08-22 11:18:06 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-22 09:18:06 -0700 |
| commit | c92abe71dfa154d62dc36f1bc7b6c00184c5dbda (patch) | |
| tree | 615357973fd5c2151dada1fa0fcf26f2f64bfd7d /t/t5574-fetch-output.sh | |
| parent | 8960819e73d266a114f731a5a9a5dd90e5ab38bc (diff) | |
| download | git-c92abe71dfa154d62dc36f1bc7b6c00184c5dbda.tar.gz | |
builtin/fetch: fix leaking transaction with `--atomic`
With the `--atomic` flag, we use a single ref transaction to commit all
ref updates in git-fetch(1). The lifetime of transactions is somewhat
weird: while `ref_transaction_abort()` will free the transaction, a call
to `ref_transaction_commit()` won't. We thus have to manually free the
transaction in the successful case.
Adapt the code to free the transaction in the exit path to plug the
resulting memory leak. As `ref_transaction_abort()` already freed the
transaction for us, we have to unset the transaction when we hit that
code path to not cause a double free.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5574-fetch-output.sh')
| -rwxr-xr-x | t/t5574-fetch-output.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t5574-fetch-output.sh b/t/t5574-fetch-output.sh index 5883839a04..f7707326ea 100755 --- a/t/t5574-fetch-output.sh +++ b/t/t5574-fetch-output.sh @@ -5,6 +5,7 @@ test_description='git fetch output format' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'fetch with invalid output format configuration' ' |
