summaryrefslogtreecommitdiff
path: root/t/t9162-git-svn-dcommit-interactive.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-08-02 15:33:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-08-03 17:16:28 (GMT)
commit055e57b7b2183cd5ae7ce8af0becd20623b3db71 (patch)
tree632110ef8f8288bbf62700700b01b2ff29224896 /t/t9162-git-svn-dcommit-interactive.sh
parentc541e77cf83707d04eeaea4e25f1147017397afe (diff)
downloadgit-055e57b7b2183cd5ae7ce8af0becd20623b3db71.zip
git-055e57b7b2183cd5ae7ce8af0becd20623b3db71.tar.gz
git-055e57b7b2183cd5ae7ce8af0becd20623b3db71.tar.bz2
log: fix a memory leak in "git show <revision>..."
Fix a memory leak in code added in 5d7eeee2ac6 (git-show: grok blobs, trees and tags, too, 2006-12-14). As we iterate over a "<revision>..." command-line and encounter ad OBJ_COMMIT we want to use our "struct rev_info", but with a "pending" array of one element: the one commit we're showing in the loop. To do this 5d7eeee2ac6 saved away a pointer to rev.pending.objects and rev.pending.nr for its iteration. We'd then clobber those (and alloc) when we needed to show an OBJ_COMMIT. We'd therefore leak the "rev.pending" we started out with, and only free the new "rev.pending" in the "OBJ_COMMIT" case arm as prepare_revision_walk() would draw it down. Let's fix this memory leak. Now when we encounter an OBJ_COMMIT we save away the "rev.pending" before clearing it. We then add a single commit to it, which our indirect invocation of prepare_revision_walk() will remove. After that we restore the "rev.pending". Our "rev.pending" will then get free'd by the release_revisions() added in f6bfea0ad01 (revisions API users: use release_revisions() in builtin/log.c, 2022-04-13) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9162-git-svn-dcommit-interactive.sh')
-rwxr-xr-xt/t9162-git-svn-dcommit-interactive.sh1
1 files changed, 0 insertions, 1 deletions
diff --git a/t/t9162-git-svn-dcommit-interactive.sh b/t/t9162-git-svn-dcommit-interactive.sh
index e2aa8ed..b3ce033 100755
--- a/t/t9162-git-svn-dcommit-interactive.sh
+++ b/t/t9162-git-svn-dcommit-interactive.sh
@@ -4,7 +4,6 @@
test_description='git svn dcommit --interactive series'
-TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh
test_expect_success 'initialize repo' '