{"thread":{"id":"56577","subject":"[PATCH] packfile: release bad_objects in close_pack()","startedAt":"2021-09-24T06:10:17Z","lastAt":"2021-09-24T20:21:13Z","messageCount":2,"participants":["René Scharfe","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"436924","messageId":"33a0120b-c10d-2709-49d3-7c3dc26565ee@web.de","threadId":"56577","inReplyTo":null,"subject":"[PATCH] packfile: release bad_objects in close_pack()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2021-09-24T06:10:10Z","receivedAt":"2021-09-24T06:10:17Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Unusable entries of a damaged pack file are recorded in the oidset\nbad_objects.  Release it when we're done with the pack.\n\nThis doesn't affect intact packs because an empty oidset requires\nno allocation.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n packfile.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/packfile.c b/packfile.c\nindex 0e92bd7bd2..89402cfc69 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -339,6 +339,7 @@ void close_pack(struct packed_git *p)\n \tclose_pack_fd(p);\n \tclose_pack_index(p);\n \tclose_pack_revindex(p);\n+\toidset_clear(&p->bad_objects);\n }\n\n void close_object_store(struct raw_object_store *o)\n--\n2.33.0\n"},{"id":"437040","messageId":"YU4zMj76HXP5PhCu@coredump.intra.peff.net","threadId":"56577","inReplyTo":"33a0120b-c10d-2709-49d3-7c3dc26565ee@web.de","subject":"Re: [PATCH] packfile: release bad_objects in close_pack()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-09-24T20:21:06Z","receivedAt":"2021-09-24T20:21:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 24, 2021 at 08:10:10AM +0200, René Scharfe wrote:\n\n> Unusable entries of a damaged pack file are recorded in the oidset\n> bad_objects.  Release it when we're done with the pack.\n> \n> This doesn't affect intact packs because an empty oidset requires\n> no allocation.\n\nGood catch. I wondered if this was related to your recent 09ef66179b\n(packfile: use oidset for bad objects, 2021-09-11), but we'd have just\nleaked the manual array before then.\n\n> diff --git a/packfile.c b/packfile.c\n> index 0e92bd7bd2..89402cfc69 100644\n> --- a/packfile.c\n> +++ b/packfile.c\n> @@ -339,6 +339,7 @@ void close_pack(struct packed_git *p)\n>  \tclose_pack_fd(p);\n>  \tclose_pack_index(p);\n>  \tclose_pack_revindex(p);\n> +\toidset_clear(&p->bad_objects);\n>  }\n\nLooks obviously correct.\n\n-Peff\n"}]}