Skip to content

Commit 2ccf570

Browse files
pks-tgitster
authored andcommitted
http-fetch: clear leaking git-index-pack(1) arguments
We never clear the arguments that we pass to git-index-pack(1). Create a common exit path and release them there to plug this leak. This is leak is exposed by t5702, but plugging the leak does not make the whole test suite pass. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6258f68 commit 2ccf570

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

http-fetch.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ int cmd_main(int argc, const char **argv)
106106
int nongit;
107107
struct object_id packfile_hash;
108108
struct strvec index_pack_args = STRVEC_INIT;
109+
int ret;
109110

110111
setup_git_directory_gently(&nongit);
111112

@@ -157,8 +158,8 @@ int cmd_main(int argc, const char **argv)
157158

158159
fetch_single_packfile(&packfile_hash, argv[arg],
159160
index_pack_args.v);
160-
161-
return 0;
161+
ret = 0;
162+
goto out;
162163
}
163164

164165
if (index_pack_args.nr)
@@ -170,7 +171,12 @@ int cmd_main(int argc, const char **argv)
170171
commit_id = (char **) &argv[arg++];
171172
commits = 1;
172173
}
173-
return fetch_using_walker(argv[arg], get_verbosely, get_recover,
174-
commits, commit_id, write_ref,
175-
commits_on_stdin);
174+
175+
ret = fetch_using_walker(argv[arg], get_verbosely, get_recover,
176+
commits, commit_id, write_ref,
177+
commits_on_stdin);
178+
179+
out:
180+
strvec_clear(&index_pack_args);
181+
return ret;
176182
}

0 commit comments

Comments
 (0)