Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: sami wagiaalla <swagiaal@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] PR 12028 "GDB crashes on a double free during overload resolution"
Date: Wed, 22 Sep 2010 18:12:00 -0000	[thread overview]
Message-ID: <4C9A2B89.4080601@redhat.com> (raw)
In-Reply-To: <AANLkTi=t9g2vsAii9OB1YM1=rUMiE6wb1kT0N-GZVjgx@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

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

[-- Attachment #2: oload_memory_leak.patch --]
[-- Type: text/x-patch, Size: 621 bytes --]

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;
     }
 }

  reply	other threads:[~2010-09-22 16:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-18  9:25 sami wagiaalla
2010-09-19 17:39 ` Doug Evans
2010-09-22 18:12   ` sami wagiaalla [this message]
2010-09-22 19:36     ` Tom Tromey
2010-09-23 18:46       ` sami wagiaalla
2010-09-27 18:02         ` Tom Tromey
2010-09-28 16:32           ` sami wagiaalla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C9A2B89.4080601@redhat.com \
    --to=swagiaal@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox