aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2023-11-26 12:57:36 +0100
committerJunio C Hamano <gitster@pobox.com>2023-11-27 09:59:56 +0900
commitcd3c28c53addae7942968f5f15854f8ce44df3ff (patch)
treef4a1c2588c13565532bb2379c76c2f506563c843
parentec583449067bab5b800ecc63926f35c9dae96fa1 (diff)
downloadgit-cd3c28c53addae7942968f5f15854f8ce44df3ff.tar.gz
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>
-rw-r--r--builtin/column.c2
-rwxr-xr-xt/t9002-column.sh1
2 files changed, 3 insertions, 0 deletions
diff --git a/builtin/column.c b/builtin/column.c
index 158fdf53d9..798161bef2 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -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;
}
diff --git a/t/t9002-column.sh b/t/t9002-column.sh
index 6d3dbde3fe..348cc40658 100755
--- a/t/t9002-column.sh
+++ b/t/t9002-column.sh
@@ -1,6 +1,7 @@
#!/bin/sh
test_description='git column'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '