commit-graph: clear oidset after finishing write

In graph_write() we store commits in an oidset, but never clean it up, leaking the contents. We should clear it in the cleanup section. The oidset comes from 6830c36077 (commit-graph.h: replace 'commit_hex' with 'commits', 2020-04-13), but it was just replacing a string_list that was also leaked. Curiously, we fixed the leak of some adjacent variables in commit fa8953cb40 (builtin/commit-graph.c: extract 'read_one_commit()', 2020-05-18), but the oidset wasn't included for some reason. In combination with the preceding commits, this lets us mark t5324 as leak-free. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 3, 2023 at 16:31 UTC da09e7af68247519e2b19fc8dff113896c39ac3c
2 files changed +3
builtin/commit-graph.c
+1
@@ -311,6 +311,7 @@ cleanup:
311 FREE_AND_NULL(options);
312 string_list_clear(&pack_indexes, 0);
313 strbuf_release(&buf);
314 + oidset_clear(&commits);
315 return result;
316 }
317
t/t5324-split-commit-graph.sh
+2
@@ -1,6 +1,8 @@
1 #!/bin/sh
2
3 test_description='split commit graph'
4 +
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 GIT_TEST_COMMIT_GRAPH=0