Re: [PATCH 3/4] remote: fix leak in branch_get_push_1() with invalid "simple" config
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 19, 2026, 06:34 UTC
- Message-ID
- <aW3QYPvRUkvwKU1E@pks.im>
- In-Reply-To
- <20260119052208.GC1991523@coredump.intra.peff.net>
On Mon, Jan 19, 2026 at 12:22:08AM -0500, Jeff King wrote:
Show 14 quoted lines
> 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