Re: [PATCH v26 2/2] status: add status.compareBranches config for multiple branch comparisons
- From
Jeff King <peff@peff.net>
- Date
- Jan 19, 2026, 05:14 UTC
- Message-ID
- <20260119051406.GA1115353@coredump.intra.peff.net>
- In-Reply-To
- <caa761f6153b5b8992c63fea5b5c0fc9b9d444a5.1768766353.git.gitgitgadget@gmail.com>
On Sun, Jan 18, 2026 at 07:59:13PM +0000, Harald Nordgren via GitGitGadget wrote:
Show 8 quoted lines
> @@ -272,6 +278,7 @@ static void branch_release(struct branch *branch) > free((char *)branch->refname); > free(branch->remote_name); > free(branch->pushremote_name); > + free((char *)branch->push_tracking_ref); > merge_clear(branch); > } >
I don't think this line is right. The push_tracking_ref field is const because it may or may not be a newly allocated string. In particular, with push.default=upstream, it will be a copy of the string returned from branch_get_upstream(), which is covered by the merge_clear() call. So we'd get a double-free.
This is due to some memory-management hackery in e291c75a95 (remote.c: add branch_get_push, 2015-05-21). The good news is that not only is it not too hard to untangle this, but it is closely related to leaks you are seeing on your topic.
I'll post a series in a moment fixing both.
-Peff