mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
transport: fix leaking arguments when fetching from bundle
In `fetch_refs_from_bundle()` we assemble a vector of arguments to pass to `unbundle()`, but never free it. And in theory we wouldn't have to because `unbundle()` already knows to free the vector for us. But it fails to do so when it exits early due to `verify_bundle()` failing. The calling convention that the arguments are freed by the callee and not the caller feels somewhat weird. Refactor the code such that it is instead the responsibility of the caller to free the vector, adapting the only two callsites where we pass extra arguments. This also fixes the memory leak. This memory leak gets hit in t5510, but fixing it isn't sufficient to make the whole test suite pass. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c92abe71df
commit
7720460ccf
4
bundle.c
4
bundle.c
@@ -639,10 +639,8 @@ int unbundle(struct repository *r, struct bundle_header *header,
|
||||
if (flags & VERIFY_BUNDLE_FSCK)
|
||||
strvec_push(&ip.args, "--fsck-objects");
|
||||
|
||||
if (extra_index_pack_args) {
|
||||
if (extra_index_pack_args)
|
||||
strvec_pushv(&ip.args, extra_index_pack_args->v);
|
||||
strvec_clear(extra_index_pack_args);
|
||||
}
|
||||
|
||||
ip.in = bundle_fd;
|
||||
ip.no_stdout = 1;
|
||||
|
||||
Reference in New Issue
Block a user