summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-10-08 15:17:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-09 09:04:15 (GMT)
commit0ce4ff942125eabed3df694dc27922bec8177624 (patch)
tree6bfd68ded410da6ed750fd571d99604cc035a421 /midx.c
parentf84b9b09d40408cf91bbc500d9f190a7866c3e0f (diff)
downloadgit-0ce4ff942125eabed3df694dc27922bec8177624.zip
git-0ce4ff942125eabed3df694dc27922bec8177624.tar.gz
git-0ce4ff942125eabed3df694dc27922bec8177624.tar.bz2
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>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index f3e8dbc..999717b 100644
--- a/midx.c
+++ b/midx.c
@@ -190,7 +190,7 @@ static void close_midx(struct multi_pack_index *m)
for (i = 0; i < m->num_packs; i++) {
if (m->packs[i]) {
close_pack(m->packs[i]);
- free(m->packs);
+ free(m->packs[i]);
}
}
FREE_AND_NULL(m->packs);