bulk-checkin: fix leaking state TODO

When flushing a bulk-checking to disk we also reset the `struct
bulk_checkin_packfile` state. But while we free some of its members,
others aren't being free'd, leading to memory leaks:

  - The temporary packfile name is not getting freed.

  - The `struct hashfile` only gets freed in case we end up calling
    `finalize_hashfile()`. There are code paths though where that is not
    the case, namely when nothing has been written. For this, we need to
    make `free_hashfile()` public.

Fix those leaks.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-08-14 08:52:03 +02:00
committed by Junio C Hamano
parent 9ddd5f755d
commit c81dcf630c
4 changed files with 14 additions and 1 deletions

View File

@ -56,7 +56,7 @@ void hashflush(struct hashfile *f)
}
}
static void free_hashfile(struct hashfile *f)
void free_hashfile(struct hashfile *f)
{
free(f->buffer);
free(f->check_buffer);