On Tue, 30 Dec 2025, Zilin Guan wrote: > On Tue, Dec 30, 2025 at 09:51:06AM+0100, Markus Elfring wrote: > > … > > > Fix this by adding a free_tmp label and jumping to it when obj is NULL, > > > ensuring tmp is properly freed. > > > > How do you think about to increase the application of scope-based > > resource management? > > > > Regards, > > Markus > > Thanks for the suggestion. > > While scope-based resource management is a valid improvement, I prefer to > keep this patch focused solely on fixing the memory leak using the > existing coding style of the file. This ensures the fix is minimal and > easier to backport. > > Such refactoring is arguably outside the scope of this fix. Hi, Lets not get too attached to the ways of the past, using __free() is what we want to use even as a fix here. Adding goto labels adds complexity, not reduces it, so I don't buy the easier backport argument (on backport each goto target should be carefully reviewed which is something __free() does not require because it simply is better interface). You just need to remember to move also the variable declaration down to the alloc site as per the guidance in cleanup.h. -- i.