From: Omar Sandoval <osan...@fb.com> dwfl_thread_getframes always frees the state before returning, so dwfl_getthreads and getthread don't need to do it.
Signed-off-by: Omar Sandoval <osan...@fb.com> --- libdwfl/ChangeLog | 6 ++++++ libdwfl/dwfl_frame.c | 18 +++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 04a39637..f4a3cad9 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,9 @@ +2019-10-07 Omar Sandoval <osan...@fb.com> + + * dwfl_frame.c (dwfl_getthreads): Get rid of unnecessary + thread_free_all_states calls. + (getthread): Ditto. + 2019-08-12 Mark Wielaard <m...@klomp.org> * gzip.c (open_stream): Return DWFL_E_ERRNO on bad file operation. diff --git a/libdwfl/dwfl_frame.c b/libdwfl/dwfl_frame.c index 881f735a..20bdbd9b 100644 --- a/libdwfl/dwfl_frame.c +++ b/libdwfl/dwfl_frame.c @@ -279,24 +279,15 @@ dwfl_getthreads (Dwfl *dwfl, int (*callback) (Dwfl_Thread *thread, void *arg), process->callbacks_arg, &thread.callbacks_arg); if (thread.tid < 0) - { - Dwfl_Error saved_errno = dwfl_errno (); - thread_free_all_states (&thread); - __libdwfl_seterrno (saved_errno); - return -1; - } + return -1; if (thread.tid == 0) { - thread_free_all_states (&thread); __libdwfl_seterrno (DWFL_E_NOERROR); return 0; } int err = callback (&thread, arg); if (err != DWARF_CB_OK) - { - thread_free_all_states (&thread); - return err; - } + return err; assert (thread.unwound == NULL); } /* NOTREACHED */ @@ -356,11 +347,8 @@ getthread (Dwfl *dwfl, pid_t tid, if (process->callbacks->get_thread (dwfl, tid, process->callbacks_arg, &thread.callbacks_arg)) { - int err; thread.tid = tid; - err = callback (&thread, arg); - thread_free_all_states (&thread); - return err; + return callback (&thread, arg); } return -1; -- 2.23.0