summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-03-29 09:15:48 +0100
committerPatrick Steinhardt <ps@pks.im>2018-03-29 09:15:48 +0100
commitb6276ae0915522b6add6ac2da9900a617515f0eb (patch)
tree82658583f81979a0f708f528c7b8964247f0ae9d
parent9e8bc7260969f8a1c8f5aba1930fd8f65947d0ad (diff)
downloadlibgit2-b6276ae0915522b6add6ac2da9900a617515f0eb.tar.gz
odb: mempack: fix leaking objects when freeing mempacks
When a ODB mempack gets free'd, we take no measures at all to free its contents, most notably the objects added to the database, resulting in a memory leak. Call `git_mempack_reset` previous to freeing the ODB structures themselves, which takes care of releasing all associated data structures.
-rw-r--r--src/odb_mempack.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index a81716ee3..e351d4df9 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -157,6 +157,7 @@ static void impl__free(git_odb_backend *_backend)
{
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
+ git_mempack_reset(_backend);
git_oidmap_free(db->objects);
git__free(db);
}