]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
addr2line: Set scopes to NULL after free in handle_address.
authorMark Wielaard <mjw@redhat.com>
Thu, 21 May 2015 14:05:18 +0000 (16:05 +0200)
committerMark Wielaard <mjw@redhat.com>
Wed, 27 May 2015 15:17:51 +0000 (17:17 +0200)
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
src/addr2line.c

index c93d54d14782b0ec95831ca97586448f5f699f61..ee180076412f66006c35af94bccdbbe23dfbe0df 100644 (file)
@@ -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.
index fc2ff284f75177e6371146e903ba2e8734af7589..97f988ff7c8f0dcb6b238fa951d388623520f29e 100644 (file)
@@ -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)