Skip to content

Commit cd3c28c

Browse files
rscharfegitster
authored andcommitted
column: release strbuf and string_list after use
Releasing strbuf and string_list just before exiting is not strictly necessary, but it gets rid of false positives reported by leak checkers, which can then be more easily used to show that the column-printing machinery behind print_columns() are free of leaks. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec58344 commit cd3c28c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

builtin/column.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,7 @@ int cmd_column(int argc, const char **argv, const char *prefix)
5555
string_list_append(&list, sb.buf);
5656

5757
print_columns(&list, colopts, &copts);
58+
strbuf_release(&sb);
59+
string_list_clear(&list, 0);
5860
return 0;
5961
}

t/t9002-column.sh

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

33
test_description='git column'
4+
TEST_PASSES_SANITIZE_LEAK=true
45
. ./test-lib.sh
56

67
test_expect_success 'setup' '

0 commit comments

Comments
 (0)