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>
Derrick Stolee committed
Oct 8, 2018 at 08:17 UTC
0ce4ff942125eabed3df694dc27922bec8177624
1 file changed
+1
-1
midx.c
+1
-1
@@ -190,7 +190,7 @@ static void close_midx(struct multi_pack_index *m)
190
for (i = 0; i < m->num_packs; i++) {
191
if (m->packs[i]) {
192
close_pack(m->packs[i]);
193
- free(m->packs);
193
+ free(m->packs[i]);
194
}
195
}
196
FREE_AND_NULL(m->packs);