summaryrefslogtreecommitdiff
path: root/t/helper/test-partial-clone.c
diff options
context:
space:
mode:
authorLibravatar Taylor Blau <me@ttaylorr.com>2021-08-31 16:52:07 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-01 10:58:43 -0700
commit9bb6c2e54f88e92ba8715f2412e57c57793721e0 (patch)
tree16795dad941f2d736c15ab263dacac7c1a333e67 /t/helper/test-partial-clone.c
parentmidx: infer preferred pack when not given one (diff)
downloadtgif-9bb6c2e54f88e92ba8715f2412e57c57793721e0.tar.xz
midx: close linked MIDXs, avoid leaking memory
When a repository has at least one alternate, the MIDX belonging to each alternate is accessed through the `next` pointer on the main object store's copy of the MIDX. close_midx() didn't bother to close any of the linked MIDXs. It likewise didn't free the memory pointed to by `m`, leaving uninitialized bytes with live pointers to them left around in the heap. Clean this up by closing linked MIDXs, and freeing up the memory pointed to by each of them. When callers call close_midx(), then they can discard the entire linked list of MIDXs and set their pointer to the head of that list to NULL. This isn't strictly required for the upcoming patches, but it makes it much more difficult (though still possible, for e.g., by calling `close_midx(m->next)` which leaves `m->next` pointing at uninitialized bytes) to have pointers to uninitialized memory. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-partial-clone.c')
0 files changed, 0 insertions, 0 deletions