Thread (11 messages) 11 messages, 3 authors, 2026-01-20

Re: [PATCH 3/4] remote: fix leak in branch_get_push_1() with invalid "simple" config

From: Patrick Steinhardt <hidden>
Date: 2026-01-19 06:34:13

On Mon, Jan 19, 2026 at 12:22:08AM -0500, Jeff King wrote:
quoted hunk ↗ jump to hunk
diff --git a/remote.c b/remote.c
index 5de9619bc7..e191b0ff6e 100644
--- a/remote.c
+++ b/remote.c
@@ -1938,9 +1938,11 @@ static const char *branch_get_push_1(struct repository *repo,
 			cur = tracking_for_push_dest(remote, branch->refname, err);
 			if (!cur)
 				return NULL;
-			if (strcmp(cur, up))
+			if (strcmp(cur, up)) {
+				free(cur);
 				return error_buf(err,
 						 _("cannot resolve 'simple' push to a single destination"));
+			}
Yup, this memory leak was easy to spot in the preceding commit after
your refactorings.

Patrick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help