]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-graph: free write-context base_graph_name during cleanup
authorJeff King <peff@peff.net>
Tue, 3 Oct 2023 20:31:11 +0000 (16:31 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Oct 2023 21:28:24 +0000 (14:28 -0700)
Commit 6c622f9f0b (commit-graph: write commit-graph chains, 2019-06-18)
added a base_graph_name string to the write_commit_graph_context struct.
But the end-of-function cleanup forgot to free it, causing a leak.

This (presumably in combination with the preceding leak-fixes) lets us
mark t5328 as leak-free.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c
t/t5328-commit-graph-64bit-time.sh

index 744b7eb1a3acbe028ddbc2a848f4482357d6bc1e..e4d09da090250c17049ce15a36bb05e645a2cd69 100644 (file)
@@ -2518,6 +2518,7 @@ int write_commit_graph(struct object_directory *odb,
 
 cleanup:
        free(ctx->graph_name);
+       free(ctx->base_graph_name);
        free(ctx->commits.list);
        oid_array_clear(&ctx->oids);
        clear_topo_level_slab(&topo_levels);
index e9c521c061c3eae86619f4eb931d40f5e3127d35..ca476e80a0d8dcc663d0cf1b678656d0e5b2868d 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='commit graph with 64-bit timestamps'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 if ! test_have_prereq TIME_IS_64BIT || ! test_have_prereq TIME_T_IS_64BIT