[PATCH 1/5] libdwfl: don't bother freeing frames outside of dwfl_thread_getframes

Omar Sandoval osandov@osandov.com
Tue Oct 29 16:17:00 GMT 2019


On Tue, Oct 29, 2019 at 04:55:27PM +0100, Mark Wielaard wrote:
> Hi Omar,
> 
> On Mon, 2019-10-07 at 02:05 -0700, Omar Sandoval wrote:
> > dwfl_thread_getframes always frees the state before returning, so
> > dwfl_getthreads and getthread don't need to do it.
> 
> I am not sure I follow. dwfl_getthreads can be used independently from
> its (indirect) usage from dwfl_thread_getframes. So doesn't it need to
> do its own cleanup?

Hi, Mark,

Unless I missed something, the only place we allocate the state is from
dwfl_thread_getframes, and we always free it before returning from that
function. So if you're not using dwfl_thread_getframes, dwfl_getthreads
won't have anything to free, and if you are, dwfl_thread_getframes
already freed it. Or am I missing something?

Thanks,
Omar



More information about the Elfutils-devel mailing list