odb/packed: fix memory leaks when freeing source
When freeing a "packed" source we don't close either its packs nor its multi-pack indices. This can cause memory leaks in case we create an ad-hoc packed source. As we used to always link packed sources to the main object database we never noticed this issue until now, but it's going to surface in subsequent commits where we stop linking them. Plug the memory leaks by closing the source first. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>jch^2
parent
bb59f6b781
commit
6543910bad
|
|
@ -844,6 +844,7 @@ static void odb_source_packed_free(struct odb_source *source)
|
|||
|
||||
chdir_notify_unregister(odb_source_packed_reparent, packed);
|
||||
|
||||
odb_source_close(source);
|
||||
for (struct packfile_list_entry *e = packed->packs.head; e; e = e->next)
|
||||
free(e->pack);
|
||||
packfile_list_clear(&packed->packs);
|
||||
|
|
|
|||
Loading…
Reference in New Issue