Skip to content

Commit 0c23f1a

Browse files
peffgitster
authored andcommitted
fetch-pack: free object filter before exiting
Our fetch_pack_args holds a filter_options struct that may be populated with allocated strings by the by the "--filter" command-line option. We must free it before exiting to avoid a leak when the program exits. The usual fetch code paths that use transport.c don't have the same leak, because we do the cleanup in disconnect_git(). Fixing this leak lets us mark t5500 as leak-free. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 91aa673 commit 0c23f1a

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

builtin/fetch-pack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,5 +293,6 @@ int cmd_fetch_pack(int argc,
293293
free(sought);
294294
free_refs(fetched_refs);
295295
free_refs(remote_refs);
296+
list_objects_filter_release(&args.filter_options);
296297
return ret;
297298
}

t/t5500-fetch-pack.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_description='Testing multi_ack pack fetching'
88
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
99
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1010

11+
TEST_PASSES_SANITIZE_LEAK=true
1112
. ./test-lib.sh
1213

1314
# Test fetch-pack/upload-pack pair.

0 commit comments

Comments
 (0)