Re: [PATCH] branch: let '--edit-description' default to rebased branch during rebase
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jan 12, 2020, 01:27 UTC
- Message-ID
- <CAPig+cRCMXjjPHc2O8fLmaSm9m-ZO3qR2BoZwG3s5dLHNbiFFQ@mail.gmail.com>
- In-Reply-To
- <CAJ+F1CKW3NACgPdPbmAzYGVwR4iO3r+LCNq+g5st0gcz4X+fzA@mail.gmail.com>
On Sat, Jan 11, 2020 at 9:55 AM Marc-André Lureau <marcandre.lureau@gmail.com> wrote:
Show 5 quoted lines
> On Sat, Jan 11, 2020 at 5:28 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > On Sat, Jan 11, 2020 at 7:36 AM <marcandre.lureau@redhat.com> 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'?
Show 8 quoted lines
> > > 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.