Re: [PATCH 02/20] convert: fix leaks when resetting attributes
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 20, 2024, 19:51 UTC
- Message-ID
- <xmqqikvv6kii.fsf@gitster.g>
- In-Reply-To
- <ed0f01bf92c83fb7371326bd1a59933619de2c47.1724159575.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
> When resetting parsed gitattributes, we free the list of convert drivers > parsed from the config. We only free some of the drivers' fields though > and thus have memory leaks. > > Fix this by freeing all allocated convert driver fields to plug these > memory leaks. > > Signed-off-by: Patrick Steinhardt <ps@pks.im> > ---
The helper has only one caller, which makes me wonder why we do not have to call it more often. If "git checkout" or "log -p" notice an attribute file is updated, I wonder they should call it, for example. But of course this is completely out of scope of this topic.
This has been leaking even before 9642479a (convert: fix leaking config strings, 2024-08-01) straightened out the ownership rules of the value obtained from git_config_string().
The fix makes sense. Will queue. Thanks.