Skip to content

Commit ac3b143

Browse files
pks-tgitster
authored andcommitted
builtin/name-rev: fix various trivial memory leaks
There are several structures that we don't release after `cmd_name_rev()` is done. Plug those leaks. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ed04100 commit ac3b143

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

builtin/name-rev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,9 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
677677
always, allow_undefined, data.name_only);
678678
}
679679

680-
UNLEAK(string_pool);
681-
UNLEAK(revs);
680+
string_list_clear(&data.ref_filters, 0);
681+
string_list_clear(&data.exclude_filters, 0);
682+
mem_pool_discard(&string_pool, 0);
683+
object_array_clear(&revs);
682684
return 0;
683685
}

t/t6007-rev-list-cherry-pick-file.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test_description='test git rev-list --cherry-pick -- file'
55
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

8+
TEST_PASSES_SANITIZE_LEAK=true
89
. ./test-lib.sh
910

1011
# A---B---D---F

t/t6120-describe.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test_description='test describe'
1414
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
1515
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1616

17+
TEST_PASSES_SANITIZE_LEAK=true
1718
. ./test-lib.sh
1819

1920
check_describe () {

0 commit comments

Comments
 (0)