[PATCH] dwarf_begin_elf.c: Fix lock resource leak

Mark Wielaard mark@klomp.org
Tue Feb 24 22:41:47 GMT 2026


Hi Aaron,

On Tue, Feb 24, 2026 at 04:08:07PM -0500, Aaron Merey wrote:
> dwarf_begin_elf might free memory for a struct Dwarf after its rwlock and
> mutex fields have been initialized without calling the corresponding
> destroy functions to release the lock resources.
> 
> Fix this by moving lock inits to the end of the valid_p function, after
> the struct Dwarf being intialized has passed all error checking.

This looks good, doing this all at the end o valid_p also makes the
code more clear.

Thanks,

Mark


More information about the Elfutils-devel mailing list