]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: fix memory leaks in `make_script_with_merges()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 11 Jun 2024 09:21:01 +0000 (11:21 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Jun 2024 20:15:07 +0000 (13:15 -0700)
Fix some trivial memory leaks in `make_script_with_merges()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3418-rebase-continue.sh
t/t3421-rebase-topology-linear.sh
t/t3434-rebase-i18n.sh

index c581061b6db22a3a8d042488ca922b46e6e1db8f..20807ea7e58785273e7c2ad8455979abbfc8c9fc 100644 (file)
@@ -5951,6 +5951,9 @@ static int make_script_with_merges(struct pretty_print_context *pp,
        strbuf_release(&oneline);
        strbuf_release(&buf);
 
+       oidset_clear(&interesting);
+       oidset_clear(&child_seen);
+       oidset_clear(&shown);
        oidmap_free(&commit2todo, 1);
        oidmap_free(&state.commit2label, 1);
        hashmap_clear_and_free(&state.labels, struct labels_entry, entry);
index 127216f7225aa412022bb0f296f716c42ce15f56..c0d29c2154f0b4eff481352fd1acb0bb1f3c2331 100755 (executable)
@@ -5,6 +5,7 @@ test_description='git rebase --continue tests'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 . "$TEST_DIRECTORY"/lib-rebase.sh
index 62d86d557dafa13fca52176e67dbe374a0e73210..737af80bb3dbb205346a3b6ccedf6cbb34fbfab2 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='basic rebase topology tests'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-rebase.sh
 
index a4e482d2cd057f4deaeb25df3c0f7f47d00ff327..26a48d6b1039a57e3111e9dafc1c8caf5422746d 100755 (executable)
@@ -17,6 +17,7 @@ Initial setup:
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 compare_msg () {