[PATCH] packfile: free packed_git memory when closing object store

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Mike Hommey <mh@xxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux