]> git.ipfire.org Git - thirdparty/git.git/commitdiff
column: release strbuf and string_list after use
authorRené Scharfe <l.s.r@web.de>
Sun, 26 Nov 2023 11:57:36 +0000 (12:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Nov 2023 00:59:56 +0000 (09:59 +0900)
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>
builtin/column.c
t/t9002-column.sh

index 158fdf53d9fb9ce3694502fe6edbc609d7839282..798161bef28ee104885f063d276209664f9c5411 100644 (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;
 }
index 6d3dbde3feb9a41dc59a42f75ef578b1ebc5b183..348cc40658235239c7e68671738cd030871451ad 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='git column'
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '