midx: fix broken free() in close_midx()
When closing a multi-pack-index, we intend to close each pack-file and free the struct packed_git that represents it. However, this line was previously freeing the array of pointers, not the pointer itself. This leads to a double-free issue. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
f84b9b09d4
commit
0ce4ff9421
2
midx.c
2
midx.c
|
@ -190,7 +190,7 @@ static void close_midx(struct multi_pack_index *m)
|
||||||
for (i = 0; i < m->num_packs; i++) {
|
for (i = 0; i < m->num_packs; i++) {
|
||||||
if (m->packs[i]) {
|
if (m->packs[i]) {
|
||||||
close_pack(m->packs[i]);
|
close_pack(m->packs[i]);
|
||||||
free(m->packs);
|
free(m->packs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE_AND_NULL(m->packs);
|
FREE_AND_NULL(m->packs);
|
||||||
|
|
Loading…
Reference in New Issue