Re: [PATCH 05/22] sequencer: allow the sequencer to take custody of malloc()ed data
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 31, 2016, 08:20 UTC
- Message-ID
- <alpine.DEB.2.20.1608311019290.129229@virtualbox>
- In-Reply-To
- <xmqqk2ey3yha.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Tue, 30 Aug 2016, Junio C Hamano wrote:
Show 7 quoted lines
> Jakub Narębski <jnareb@gmail.com> writes: > > > In my personal opinion 'set_me_free_after_use' is not the best name, > > but I unfortunately do not have a better proposal. Maybe 'entrust_ptr', > > or 'entrusted_data' / 'entrusted_ptr' / 'entrusted'? > > Is this to accumulate to-be-freed pointers?
Yes.
> I think we often call a local variable that points at a piece of > memory to be freed "to_free", and that is an appropriate name for > what this function is trying to do.
I changed it to that.
Show 5 quoted lines
> It is a bit surprising that the careless memory management in this > codepath leaks only the dumb pieces of memory (as opposed to > pointers to structures like string list that needs _clear() > functions, in which case we cannot get away with list of > to-be-freed). I guess we were somewhat lucky ;-)
Yeah, the carelessness is more like a convenience where the config machinery is reused to parse the values.
Ciao, Dscho