This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] addr2line: Set scopes to NULL after free in handle_address.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 21 May 2015 16:07:40 +0200
- Subject: [PATCH] addr2line: Set scopes to NULL after free in handle_address.
If dwarf_getscopes_die () fails then scopes might not be reset and we
could cause a double free.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
src/ChangeLog | 4 ++++
src/addr2line.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/src/ChangeLog b/src/ChangeLog
index c93d54d..ee18007 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-21 Mark Wielaard <mjw@redhat.com>
+
+ * addr2line.c (handle_address): Set scopes to NULL after free.
+
2015-05-20 Mark Wielaard <mjw@redhat.com>
* addr2line.c (OPT_PRETTY): New constant define.
diff --git a/src/addr2line.c b/src/addr2line.c
index fc2ff28..97f988f 100644
--- a/src/addr2line.c
+++ b/src/addr2line.c
@@ -744,6 +744,7 @@ handle_address (const char *string, Dwfl *dwfl)
dwarf_offdie (dwfl_module_getdwarf (mod, &bias),
dieoff, &subroutine);
free (scopes);
+ scopes = NULL;
nscopes = dwarf_getscopes_die (&subroutine, &scopes);
if (nscopes > 1)
--
1.8.3.1