summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-10-26 21:01:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-27 23:26:37 (GMT)
commit492cb394fb2bcfa9a2f0f3f6cab466909927523f (patch)
tree6d37912dd4ee385518d7ff543c9d101367a16d57 /midx.c
parent692305ec677b6ff67b67db9f1d55e7ca77e9dd9a (diff)
downloadgit-492cb394fb2bcfa9a2f0f3f6cab466909927523f.zip
git-492cb394fb2bcfa9a2f0f3f6cab466909927523f.tar.gz
git-492cb394fb2bcfa9a2f0f3f6cab466909927523f.tar.bz2
midx.c: don't leak MIDX from verify_midx_file
The function midx.c:verify_midx_file() allocates a MIDX struct by calling load_multi_pack_index(). But when cleaning up, it calls free() without freeing any resources associated with the MIDX. Call the more appropriate close_midx() which does free those resources, which causes t5319.3 to pass when Git is compiled with SANITIZE=leak. 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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index 7a8b027..e529ca7 100644
--- a/midx.c
+++ b/midx.c
@@ -1603,7 +1603,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
* Remaining tests assume that we have objects, so we can
* return here.
*/
- return verify_midx_error;
+ goto cleanup;
}
if (flags & MIDX_PROGRESS)
@@ -1681,7 +1681,9 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
}
stop_progress(&progress);
+cleanup:
free(pairs);
+ close_midx(m);
return verify_midx_error;
}