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]

Re: [patch] PR 12028 "GDB crashes on a double free during overload resolution"


On 09/18/2010 12:03 PM, Doug Evans wrote:
On Fri, Sep 17, 2010 at 7:41 AM, sami wagiaalla<swagiaal@redhat.com> wrote:
old_cleanups was being set twice making the later call to discard_cleanups
ignore the first 'make_cleanup' request.

The patch is proposed for both head and the 7.2 branch.

This has been regression tested on x8664 with gcc-4.4.4-10.fc13

Sami


Hi. This patch is ok.



Thanks for the review.


Looking at the function though, is this a memory leak?
i.e. you want to do_cleanups here, not discard them (right?).

   else
     {
       *oload_syms = new_oload_syms;
       *oload_champ = new_oload_champ;
       *oload_champ_bv = new_oload_champ_bv;
       discard_cleanups (old_cleanups);
       return 0;
     }

I agree. I have attached a patch which has been regression tested on x8664 with gcc-4.4.4-10.fc13


Sami
Fix find_oload_champ_namespace_loop memory leak.

2010-09-22  Sami Wagiaalla  <swagiaal@redhat.com>

	* valops.c (find_oload_champ_namespace_loop): replace incorrect
	discard_cleanups do_cleanups.

diff --git a/gdb/valops.c b/gdb/valops.c
index bbbf66e..13c83ff 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -2760,7 +2760,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
       *oload_syms = new_oload_syms;
       *oload_champ = new_oload_champ;
       *oload_champ_bv = new_oload_champ_bv;
-      discard_cleanups (old_cleanups);
+      do_cleanups (old_cleanups);
       return 0;
     }
 }

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