midx: fix broken free() in close_midx()
[gitweb.git] / midx.c
diff --git a/midx.c b/midx.c
index 0710c4c175c72d17428b5c4e67018185b789a973..999717b96f6b30b4614ee2fb51417e10db6cc55d 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -190,14 +190,14 @@ 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);
        FREE_AND_NULL(m->pack_names);
 }
 
-static int prepare_midx_pack(struct multi_pack_index *m, uint32_t pack_int_id)
+int prepare_midx_pack(struct multi_pack_index *m, uint32_t pack_int_id)
 {
        struct strbuf pack_name = STRBUF_INIT;