Re: Re*: [PATCH] change contract between system_path and it's callers
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 24, 2014, 20:50 UTC
- Message-ID
- <xmqqbnnwwcg0.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <87ppcc4b2g.fsf@gmail.com>
Alex Kuleshov <kuleshovmail@gmail.com> writes:
Show 16 quoted lines
>> One thing to note is that this illustration does not consider memory
>> pointed at by the "system_wide" variable here (from attr.c)
>>
>> static const char *git_etc_gitattributes(void)
>> {
>> static const char *system_wide;
>> if (!system_wide)
>> system_wide = system_path(ETC_GITATTRIBUTES);
>> return system_wide;
>> }
>>
>> at the point of process exit as a "leak".
>
> But why? We allocated memory to "system_wide" with system_path, next git
> will exit somewhere with die, but system_wide didn't free... Or i'm
> wrong here too?It is in the same league as "static const char *git_dir" and friends that appear in the file-scope-static of environment.c. Keeping small things around to be cleaned up by exit() is not a crime.