"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: privsep.c memory leak
To:
Kyle Ackerman <kackerman0102@gmail.com>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 21 Nov 2023 10:53:07 +0100

Download raw body.

Thread
On 2023/11/18 08:35:02 -0600, Kyle Ackerman <kackerman0102@gmail.com> wrote:
> Thanks Omar! 
> 
> Should we try and catch and return those errors?

Yes, that's what the patch I've inlined at the bottom of the mail (and
committed yersterday) did.  Here's it again for convenience:


commit 2bde3e78a5bd6619af838df19eec530e23783c0b (main, got/main, origin/main)
from: Omar Polo <op@omarpolo.com>
date: Mon Nov 20 17:49:55 2023 UTC
 
 don't ignore err in got_privsep_recv_painted_commits
 
diff 56a9d3151cd30e0b62e13d1469bc2f6b6a24f231 2bde3e78a5bd6619af838df19eec530e23783c0b
commit - 56a9d3151cd30e0b62e13d1469bc2f6b6a24f231
commit + 2bde3e78a5bd6619af838df19eec530e23783c0b
blob - 2109bc13bcb9c7dbfb07021a640c5fa125e74954
blob + f0f625ddad473f4c65fabd04e165b109d87dacb7
--- lib/privsep.c
+++ lib/privsep.c
@@ -3518,7 +3518,7 @@ got_privsep_recv_painted_commits(struct got_object_id_
 		datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
 		if (imsg.hdr.type == GOT_IMSG_COMMIT_PAINTING_DONE) {
 			imsg_free(&imsg);
-			break;
+			return NULL;
 		}
 		if (imsg.hdr.type != GOT_IMSG_PAINTED_COMMITS){
 			imsg_free(&imsg);
@@ -3561,9 +3561,9 @@ got_privsep_recv_painted_commits(struct got_object_id_
 		}
 
 		imsg_free(&imsg);
+		if (err)
+			return err;
 	}
-
-	return err;
 }
 
 const struct got_error *