Re: [PATCH v26 2/2] status: add status.compareBranches config for multiple branch comparisons
From: Jeff King <hidden>
Date: 2026-01-19 05:14:16
From: Jeff King <hidden>
Date: 2026-01-19 05:14:16
On Sun, Jan 18, 2026 at 07:59:13PM +0000, Harald Nordgren via GitGitGadget wrote:
@@ -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