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 <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2023-11-26 12:57:36 +01:00 committed by Junio C Hamano
parent ec58344906
commit cd3c28c53a
2 changed files with 3 additions and 0 deletions

View file

@ -55,5 +55,7 @@ int cmd_column(int argc, const char **argv, const char *prefix)
string_list_append(&list, sb.buf);
print_columns(&list, colopts, &copts);
strbuf_release(&sb);
string_list_clear(&list, 0);
return 0;
}

View file

@ -1,6 +1,7 @@
#!/bin/sh
test_description='git column'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '