Skip to content

Commit da09e7a

Browse files
peffgitster
authored andcommitted
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 6830c36 (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 fa8953c (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d9c84c6 commit da09e7a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

builtin/commit-graph.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ static int graph_write(int argc, const char **argv, const char *prefix)
311311
FREE_AND_NULL(options);
312312
string_list_clear(&pack_indexes, 0);
313313
strbuf_release(&buf);
314+
oidset_clear(&commits);
314315
return result;
315316
}
316317

t/t5324-split-commit-graph.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='split commit graph'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57

68
GIT_TEST_COMMIT_GRAPH=0

0 commit comments

Comments
 (0)