From b4d6f0f8064f2b706ea9035ef0393d8299671390 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 25 Aug 2008 22:55:17 +0000 Subject: Fix up bogon and missing log entries from .pmachata.threads branch. --- libdwfl/dwfl_end.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'libdwfl/dwfl_end.c') diff --git a/libdwfl/dwfl_end.c b/libdwfl/dwfl_end.c index 4bd40052..429abb13 100644 --- a/libdwfl/dwfl_end.c +++ b/libdwfl/dwfl_end.c @@ -52,15 +52,20 @@ void dwfl_end (Dwfl *dwfl) { - if (dwfl != NULL) + if (dwfl == NULL) + return; + + free (dwfl->lookup_addr); + free (dwfl->lookup_module); + free (dwfl->lookup_segndx); + + Dwfl_Module *next = dwfl->modulelist; + while (next != NULL) { - while (dwfl->modulelist != NULL) - { - Dwfl_Module *mod = dwfl->modulelist; - dwfl->modulelist = mod->next; - __libdwfl_module_free (mod); - } - free (dwfl->modules); - free (dwfl); + Dwfl_Module *dead = next; + next = dead->next; + __libdwfl_module_free (dead); } + + free (dwfl); } -- cgit v1.2.3