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 <ps@pks.im> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Sep 24, 2024 at 17:50 UTC
2ccf570efeb673a28f6f84c749238b33aa1be688
1 file changed
+11
-5
http-fetch.c
+11
-5
@@ -106,6 +106,7 @@ int cmd_main(int argc, const char **argv)
106
int nongit;
107
struct object_id packfile_hash;
108
struct strvec index_pack_args = STRVEC_INIT;
109
+ int ret;
110
111
setup_git_directory_gently(&nongit);
112
@@ -157,8 +158,8 @@ int cmd_main(int argc, const char **argv)
158
159
fetch_single_packfile(&packfile_hash, argv[arg],
160
index_pack_args.v);
160
-
161
- return 0;
161
+ ret = 0;
162
+ goto out;
163
}
164
165
if (index_pack_args.nr)
@@ -170,7 +171,12 @@ int cmd_main(int argc, const char **argv)
171
commit_id = (char **) &argv[arg++];
172
commits = 1;
173
}
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;
182
}