Skip to content

Commit 149c83e

Browse files
pks-tgitster
authored andcommitted
builtin/pack-objects: plug leaking list of keep-packs
The `--keep-pack` option of git-pack-objects(1) populates the arguments into a string list. And while the list is marked as `NODUP` and thus won't duplicate the strings, the list entries themselves still need to be free'd. We don't though, causing a leak. Plug it. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 860b678 commit 149c83e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

builtin/pack-objects.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4641,6 +4641,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
46414641
cleanup:
46424642
clear_packing_data(&to_pack);
46434643
list_objects_filter_release(&filter_options);
4644+
string_list_clear(&keep_pack_list, 0);
46444645
strvec_clear(&rp);
46454646

46464647
return 0;

t/t5616-partial-clone.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test_description='git partial clone'
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
# create a normal "src" repo where we can later create new commits.

0 commit comments

Comments
 (0)