Re: [PATCH v4 01/14] config: clarify memory ownership when preparing comment strings
From: Kristoffer Haugsbakk <hidden>
Date: 2024-05-03 10:13:44
From: Kristoffer Haugsbakk <hidden>
Date: 2024-05-03 10:13:44
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