This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: fix dangling cleanup


I'm checking this in.

read_structure_type allocates a null cleanup, but then does an early
return without handling the cleanup.  This leaves a cleanup dangling --
in this case no big deal, but in general this is a bug.

This patch fixes the problem by moving the null cleanup lower.

Tom

2010-06-28  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (read_structure_type): Allocate null cleanup later.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.402
diff -u -r1.402 dwarf2read.c
--- dwarf2read.c	21 Jun 2010 19:49:19 -0000	1.402
+++ dwarf2read.c	28 Jun 2010 18:53:35 -0000
@@ -5082,7 +5082,7 @@
   struct type *type;
   struct attribute *attr;
   char *name;
-  struct cleanup *back_to = make_cleanup (null_cleanup, 0);
+  struct cleanup *back_to;
 
   /* If the definition of this type lives in .debug_types, read that type.
      Don't follow DW_AT_specification though, that will take us back up
@@ -5101,6 +5101,8 @@
       return set_die_type (die, type, cu);
     }
 
+  back_to = make_cleanup (null_cleanup, 0);
+
   type = alloc_type (objfile);
   INIT_CPLUS_SPECIFIC (type);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]