]> git.ipfire.org Git - thirdparty/git.git/commitdiff
leak tests: fix a memory leak in "test-progress" helper
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 3 Feb 2022 21:40:11 +0000 (22:40 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 3 Feb 2022 23:39:55 +0000 (15:39 -0800)
Fix a memory leak in the test-progress helper, and mark the
corresponding "t0500-progress-display.sh" test as being leak-free
under SANITIZE=leak. This fixes a leak added in 2bb74b53a4 (Test the
progress display, 2019-09-16).

My 48f68715b14 (tr2: stop leaking "thread_name" memory, 2021-08-27)
had fixed another memory leak in this test (as it did some trace2
testing).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-progress.c
t/t0500-progress-display.sh

index 5d05cbe7894097f6410328b966bda936e678237f..9265e6ab7cf50eb9d0e0c185e4255587e7194387 100644 (file)
@@ -69,6 +69,7 @@ int cmd__progress(int argc, const char **argv)
                        die("invalid input: '%s'\n", line.buf);
        }
        stop_progress(&progress);
+       strbuf_release(&line);
 
        return 0;
 }
index 22058b503ac78c41f542eb02a5a3dbd1cb200d3e..f37cf2eb9c96854046a9734073683fdb452c761a 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='progress display'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 show_cr () {