summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-10-21 03:39:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-21 16:07:55 (GMT)
commit692305ec677b6ff67b67db9f1d55e7ca77e9dd9a (patch)
treed83d447f9628abf5f5da9c1007eae72d30c5a372 /midx.c
parent9d530dc0024503ab4218fe6c4395b8a0aa245478 (diff)
downloadgit-692305ec677b6ff67b67db9f1d55e7ca77e9dd9a.zip
git-692305ec677b6ff67b67db9f1d55e7ca77e9dd9a.tar.gz
git-692305ec677b6ff67b67db9f1d55e7ca77e9dd9a.tar.bz2
midx.c: clean up chunkfile after reading the MIDX
In order to read the contents of a MIDX, we initialize a chunkfile structure which can read the table of contents and assign pointers into different sections of the file for us. We do call free(), since the chunkfile struct is heap allocated, but not the more appropriate free_chunkfile(), which also frees memory that the structure itself owns. Call that instead to avoid leaking memory in this function. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index 7e06e85..7a8b027 100644
--- a/midx.c
+++ b/midx.c
@@ -179,12 +179,13 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local
trace2_data_intmax("midx", the_repository, "load/num_packs", m->num_packs);
trace2_data_intmax("midx", the_repository, "load/num_objects", m->num_objects);
+ free_chunkfile(cf);
return m;
cleanup_fail:
free(m);
free(midx_name);
- free(cf);
+ free_chunkfile(cf);
if (midx_map)
munmap(midx_map, midx_size);
if (0 <= fd)