Re: [PATCH v7 4/4] notes: teach git-notes about notes.<ref>.mergestrategy option
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 14, 2015, 22:10 UTC
- Message-ID
- <CAPig+cTxmFCRChzahQZVpMeJ=3N0PjHAcamFBm394OgTR8LnLw@mail.gmail.com>
- In-Reply-To
- <xmqq8u9dh6lq.fsf@gitster.dls.corp.google.com>
On Fri, Aug 14, 2015 at 6:01 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Jacob Keller <jacob.e.keller@intel.com> writes:
>> diff --git a/builtin/notes.c b/builtin/notes.c
>> index 12a42b583f98..bdfd9c7d29b4 100644
>> --- a/builtin/notes.c
>> +++ b/builtin/notes.c
>> + strbuf_addf(&merge_key, "notes.%s.mergestrategy", short_ref);
>> +
>> + if (git_config_get_notes_strategy(merge_key.buf, &o.strategy))
>> + git_config_get_notes_strategy("notes.mergestrategy", &o.strategy);
>> }
>
> I think you are leaking merge_key after you are done using it.In addition to fixing the leak, since 'merge_key' is only used within this block, it might also make sense to declare it in this block rather than at the top of the function.