git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] packfile: release bad_objects in close_pack()
@ 2021-09-24  6:10 René Scharfe
  2021-09-24 20:21 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2021-09-24  6:10 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

Unusable entries of a damaged pack file are recorded in the oidset
bad_objects.  Release it when we're done with the pack.

This doesn't affect intact packs because an empty oidset requires
no allocation.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 packfile.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/packfile.c b/packfile.c
index 0e92bd7bd2..89402cfc69 100644
--- a/packfile.c
+++ b/packfile.c
@@ -339,6 +339,7 @@ void close_pack(struct packed_git *p)
 	close_pack_fd(p);
 	close_pack_index(p);
 	close_pack_revindex(p);
+	oidset_clear(&p->bad_objects);
 }

 void close_object_store(struct raw_object_store *o)
--
2.33.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] packfile: release bad_objects in close_pack()
  2021-09-24  6:10 [PATCH] packfile: release bad_objects in close_pack() René Scharfe
@ 2021-09-24 20:21 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2021-09-24 20:21 UTC (permalink / raw)
  To: René Scharfe; +Cc: Git List, Junio C Hamano

On Fri, Sep 24, 2021 at 08:10:10AM +0200, René Scharfe wrote:

> Unusable entries of a damaged pack file are recorded in the oidset
> bad_objects.  Release it when we're done with the pack.
> 
> This doesn't affect intact packs because an empty oidset requires
> no allocation.

Good catch. I wondered if this was related to your recent 09ef66179b
(packfile: use oidset for bad objects, 2021-09-11), but we'd have just
leaked the manual array before then.

> diff --git a/packfile.c b/packfile.c
> index 0e92bd7bd2..89402cfc69 100644
> --- a/packfile.c
> +++ b/packfile.c
> @@ -339,6 +339,7 @@ void close_pack(struct packed_git *p)
>  	close_pack_fd(p);
>  	close_pack_index(p);
>  	close_pack_revindex(p);
> +	oidset_clear(&p->bad_objects);
>  }

Looks obviously correct.

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-24 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  6:10 [PATCH] packfile: release bad_objects in close_pack() René Scharfe
2021-09-24 20:21 ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).