2011-02-26 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Sun, 27 Feb 2011 01:54:30 +0000 (01:54 +0000)
committerMichael Snyder <msnyder@vmware.com>
Sun, 27 Feb 2011 01:54:30 +0000 (01:54 +0000)
* breakpoint.c (reattach_breakpoints): Avoid resource leak (ui_file).

gdb/ChangeLog
gdb/breakpoint.c

index 95e92d0c012072dc9f5437b8931848e18f436146..1ae76bda924521c834073d849a37b2feb9e302ac 100644 (file)
@@ -1,5 +1,7 @@
 2011-02-26  Michael Snyder  <msnyder@vmware.com>
 
+       * breakpoint.c (reattach_breakpoints): Avoid resource leak (ui_file).
+
        * maint.c (maintenance_do_deprecate): Plug a memory leak.
 
        * dwarf2loc.c (insert_bits): Avoid shadowing a function param
index 484a831040aeb135db0a6e21d29885b98ef5bf96..490084e59c5311842f37f7f0dba671ac8da247fb 100644 (file)
@@ -1989,7 +1989,7 @@ reattach_breakpoints (int pid)
   struct cleanup *old_chain;
   struct bp_location *bl, **blp_tmp;
   int val;
-  struct ui_file *tmp_error_stream = mem_fileopen ();
+  struct ui_file *tmp_error_stream;
   int dummy1 = 0, dummy2 = 0;
   struct inferior *inf;
   struct thread_info *tp;
@@ -2003,6 +2003,7 @@ reattach_breakpoints (int pid)
 
   inferior_ptid = tp->ptid;
 
+  tmp_error_stream = mem_fileopen ();
   make_cleanup_ui_file_delete (tmp_error_stream);
 
   ALL_BP_LOCATIONS (bl, blp_tmp)