Re: [PATCHv3 20/20] diff.c: color moved lines differently
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- May 19, 2017, 19:34 UTC
- Message-ID
- <CAGf8dgLRsHPdvxza6YJQXi4C8Q7QLw5A6LfFARSZ9639cGvb+w@mail.gmail.com>
- In-Reply-To
- <CAGZ79kYzgZeAnYsEODEYAEavvABS89oSq9Zj80=eS2ObtnMmNg@mail.gmail.com>
On Fri, May 19, 2017 at 11:40 AM, Stefan Beller <sbeller@google.com> wrote:
Show 12 quoted lines
>>> +static unsigned get_line_hash(struct buffered_patch_line *line, unsigned ignore_ws)
>>> +{
>>> + static struct strbuf sb = STRBUF_INIT;
>>> +
>>> + if (ignore_ws) {
>>> + strbuf_reset(&sb);
>>> + get_ws_cleaned_string(line, &sb);
>>
>> Memory leak here, I think.
>
> It's static, so we don't care.
> I can make it non-static and release the memory in a resend.Ah, I missed the "static". It seems that "static" is used elsewhere too, so these functions are not reentrant anyway, so this is fine.