git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/7] tests: fix test-oid-array leak, test in SANITIZE=leak

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 6, 2021, 10:02 UTC
Message-ID
<patch-4.7-4aa2a70c67e-20211006T095426Z-avarab@gmail.com>
In-Reply-To
<cover-0.7-00000000000-20211006T095426Z-avarab@gmail.com>

Fix a trivial memory leak present ever since 38d905bf585 (sha1-array: add test-sha1-array and basic tests, 2014-10-01), now that that's fixed we can test this under GIT_TEST_PASSING_SANITIZE_LEAK=true.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/helper/test-oid-array.c | 4 ++++
 t/t0064-oid-array.sh      | 2 ++
 2 files changed, 6 insertions(+)
diff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c
index b16cd0b11b1..d1324d086a2 100644
--- a/t/helper/test-oid-array.c
+++ b/t/helper/test-oid-array.c
@@ -35,5 +35,9 @@ int cmd__oid_array(int argc, const char **argv)
 		else
 			die("unknown command: %s", line.buf);
 	}
+
+	strbuf_release(&line);
+	oid_array_clear(&array);
+
 	return 0;
 }
diff --git a/t/t0064-oid-array.sh b/t/t0064-oid-array.sh
index 2e5438ccdac..88c89e8f48a 100755
--- a/t/t0064-oid-array.sh
+++ b/t/t0064-oid-array.sh
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='basic tests for the oid array implementation'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 echoid () {
-- 
2.33.0.1441.gbbcdb4c3c66
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 7 of 23 in “leak tests: fix "test-tool" & other small leaks”
  1. 0/7 leak tests: fix "test-tool" & other small leaksÆvar Arnfjörð Bjarmason, Oct 6, 2021
  2. 1/7 tests: fix a memory leak in test-prio-queue.cÆvar Arnfjörð Bjarmason, Oct 6, 2021
  3. 2/7 tests: fix a memory leak in test-parse-options.cÆvar Arnfjörð Bjarmason, Oct 6, 2021
  4. Elijah NewrenOct 6, 2021
  5. 3/7 tests: fix a memory leak in test-oidtree.cÆvar Arnfjörð Bjarmason, Oct 6, 2021
  6. 5/7 ls-files: fix a trivial dir_clear() leakÆvar Arnfjörð Bjarmason, Oct 6, 2021
  7. 4/7 tests: fix test-oid-array leak, test in SANITIZE=leakÆvar Arnfjörð Bjarmason, Oct 6, 2021
  8. 6/7 ls-files: add missing string_list_clear()Ævar Arnfjörð Bjarmason, Oct 6, 2021
  9. 7/7 merge: add missing strbuf_release()Ævar Arnfjörð Bjarmason, Oct 6, 2021
  10. Elijah NewrenOct 6, 2021
  11. 0/7 leak tests: fix "test-tool" & other small leaksÆvar Arnfjörð Bjarmason, Oct 7, 2021
  12. 1/7 tests: fix a memory leak in test-prio-queue.cÆvar Arnfjörð Bjarmason, Oct 7, 2021
  13. 2/7 tests: fix a memory leak in test-parse-options.cÆvar Arnfjörð Bjarmason, Oct 7, 2021
  14. 3/7 tests: fix a memory leak in test-oidtree.cÆvar Arnfjörð Bjarmason, Oct 7, 2021
  15. 4/7 tests: fix test-oid-array leak, test in SANITIZE=leakÆvar Arnfjörð Bjarmason, Oct 7, 2021
  16. 7/7 merge: add missing strbuf_release()Ævar Arnfjörð Bjarmason, Oct 7, 2021
  17. 6/7 ls-files: add missing string_list_clear()Ævar Arnfjörð Bjarmason, Oct 7, 2021
  18. 5/7 ls-files: fix a trivial dir_clear() leakÆvar Arnfjörð Bjarmason, Oct 7, 2021
  19. Junio C HamanoOct 7, 2021
  20. Ævar Arnfjörð BjarmasonOct 13, 2021
  21. Junio C HamanoOct 13, 2021
  22. Ævar Arnfjörð BjarmasonOct 14, 2021
  23. Junio C HamanoOct 14, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.