From: Eric Sunshine Date: Sun, 12 Jan 2020 01:27:11 GMT Subject: Re: [PATCH] branch: let '--edit-description' default to rebased branch during rebase Message-ID: In-Reply-To: On Sat, Jan 11, 2020 at 9:55 AM Marc-André Lureau wrote: > On Sat, Jan 11, 2020 at 5:28 PM Eric Sunshine wrote: > > On Sat, Jan 11, 2020 at 7:36 AM wrote: > > > + if (wt_status_check_rebase(NULL, &state)) { > > > + branch_name = state.branch; > > > + } Taking a deeper look at the code, I'm wondering it would make more sense to call wt_status_get_state(), which handles 'rebase' and 'bisect'. Is there a reason that you limited this check to only 'rebase'? > > > if (edit_branch_description(branch_name)) > > > return 1; > > > + > > > + free(branch_name); > > > > That `return 1` just above this free() is leaking 'branch_name', isn't it? > > right, let's fix that too Looking at the code itself (rather than consulting only the patch), I see that there are a couple more early returns leaking 'branch_name', so they need to be handled, as well.