git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] packfile: free packed_git memory when closing object store
@ 2019-08-26  2:45 Mike Hommey
  2019-08-26 18:06 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Hommey @ 2019-08-26  2:45 UTC (permalink / raw)
  To: git; +Cc: gitster

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 packfile.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Note, I'm not sure this is the right place to do it.

diff --git a/packfile.c b/packfile.c
index fc43a6c52c..b0cb84adda 100644
--- a/packfile.c
+++ b/packfile.c
@@ -339,13 +339,16 @@ void close_pack(struct packed_git *p)
 
 void close_object_store(struct raw_object_store *o)
 {
-	struct packed_git *p;
+	struct packed_git *p = o->packed_git;
 
-	for (p = o->packed_git; p; p = p->next)
+	while (p) {
+		struct packed_git *current = p;
 		if (p->do_not_close)
 			BUG("want to close pack marked 'do-not-close'");
-		else
-			close_pack(p);
+		close_pack(p);
+		p = p->next;
+		free(current);
+	}
 
 	if (o->multi_pack_index) {
 		close_midx(o->multi_pack_index);
-- 
2.23.0


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

end of thread, other threads:[~2019-08-27  0:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-26  2:45 [PATCH] packfile: free packed_git memory when closing object store Mike Hommey
2019-08-26 18:06 ` Junio C Hamano
2019-08-27  0:25   ` Mike Hommey

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).