Skip to content

Commit 0ce4ff9

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f84b9b0 commit 0ce4ff9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

midx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static void close_midx(struct multi_pack_index *m)
190190
for (i = 0; i < m->num_packs; i++) {
191191
if (m->packs[i]) {
192192
close_pack(m->packs[i]);
193-
free(m->packs);
193+
free(m->packs[i]);
194194
}
195195
}
196196
FREE_AND_NULL(m->packs);

0 commit comments

Comments
 (0)