From: Kristoffer Haugsbakk Date: Fri, 03 May 2024 10:13:17 GMT Subject: Re: [PATCH v4 01/14] config: clarify memory ownership when preparing comment strings Message-ID: <6d8af89c-614d-43a1-a8b5-83a0fc17ad94@app.fastmail.com> In-Reply-To: <3aa26d5bff21e0b93736b1502fa90694f6b2cedc.1714730169.git.ps@pks.im> On Fri, May 3, 2024, at 11:56, Patrick Steinhardt wrote: > The ownership of memory returned when preparing a comment string is > quite intricate: when the returned value is different than the passed > value, then the caller is responsible to free the memory. This is quite > subtle, and it's even easier to miss because the returned value is in > fact a `const char *`. > > Adapt the function to always return either `NULL` or a newly allocated > string. The function is called at most once per git-config(1), so it's > not like this micro-optimization really matters. Thus, callers are now > always responsible for freeing the value. > --- Missing a signoff on this one. The only one in the series. -- Kristoffer Haugsbakk