summaryrefslogtreecommitdiffstats
path: root/midx.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-12-14 23:23:39 +0100
committerJunio C Hamano <gitster@pobox.com>2023-12-14 23:38:07 +0100
commit66f0c71073ee5fe1c9d12d2952305a4793d7b43f (patch)
tree240dbb9ba6246592470e7d8d78a35dd24319ad27 /midx.c
parentStart the 2.44 cycle (diff)
downloadgit-66f0c71073ee5fe1c9d12d2952305a4793d7b43f.tar.xz
git-66f0c71073ee5fe1c9d12d2952305a4793d7b43f.zip
pack-objects: free packing_data in more places
The pack-objects internals use a packing_data struct to track what objects are part of the pack(s) being formed. Since these structures contain allocated fields, failing to appropriately free() them results in a leak. Plug that leak by introducing a clear_packing_data() function, and call it in the appropriate spots. This is a fairly straightforward leak to plug, since none of the callers expect to read any values or have any references to parts of the address space being freed. 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.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/midx.c b/midx.c
index 1d14661dad..778dd536c8 100644
--- a/midx.c
+++ b/midx.c
@@ -1603,8 +1603,13 @@ static int write_midx_internal(const char *object_dir,
flags) < 0) {
error(_("could not write multi-pack bitmap"));
result = 1;
+ clear_packing_data(&pdata);
+ free(commits);
goto cleanup;
}
+
+ clear_packing_data(&pdata);
+ free(commits);
}
/*
* NOTE: Do not use ctx.entries beyond this point, since it might