]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: fix a memory leak in test-oidtree.c
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 7 Oct 2021 10:01:33 +0000 (12:01 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Oct 2021 22:40:15 +0000 (15:40 -0700)
Fix a memory leak in t/helper/test-oidtree.c, we were not freeing the
"struct strbuf" we used for the stdin input we parsed. This leak has
been here ever since 92d8ed8ac10 (oidtree: a crit-bit tree for
odb_loose_cache, 2021-07-07).

Now that it's fixed we can declare that t0069-oidtree.sh will pass
under GIT_TEST_PASSING_SANITIZE_LEAK=true.

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

index 180ee28dd935fc3aa94f513e72131abc4f523c96..d48a409f4e4fb377a7cbc4684fa05737ea32f2c1 100644 (file)
@@ -45,5 +45,8 @@ int cmd__oidtree(int argc, const char **argv)
                        die("unknown command: %s", line.buf);
                }
        }
+
+       strbuf_release(&line);
+
        return 0;
 }
index bfb1397d7b23610539803bb5c40484df6b02c836..74cc59bf8a7de8dfe1f4605c5cd1059d889bc4c6 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='basic tests for the oidtree implementation'
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 maxhexsz=$(test_oid hexsz)