Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Khoo Yit Phang <khooyp@cs.umd.edu>
Cc: gdb@sourceware.org
Subject: Re: xfree/make_cleanup memory leak pattern?
Date: Wed, 11 Jan 2012 00:31:00 -0000	[thread overview]
Message-ID: <20120111003035.GA11850@host2.jankratochvil.net> (raw)
In-Reply-To: <197CEDA3-0851-4FD2-B821-FD800C991F2D@cs.umd.edu>

On Wed, 11 Jan 2012 01:25:06 +0100, Khoo Yit Phang wrote:
> I noticed the following code pattern in various places in GDB:
> 	script = compute_python_string (cmd->body_list[0]);
> 	...
> 	xfree (script);
> 
> and also others like:
> 	full_path = tilde_expand (filename);
> 	...
> 	cleanup = make_cleanup (xfree, full_path); 

immediate_quit will cause:
	fatal ("Quit");

which calls throw_exception in the end so all the intermediate cleanup
functions get called.  You can trace/debug it yourself.

I do not see a leak there.  Could you provide some debugging output proving
the memory is being leaked?


Thanks,
Jan


  reply	other threads:[~2012-01-11  0:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:25 Khoo Yit Phang
2012-01-11  0:31 ` Jan Kratochvil [this message]
2012-01-11  0:32   ` Jan Kratochvil
2012-01-11 14:31     ` Tom Tromey

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=20120111003035.GA11850@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=khooyp@cs.umd.edu \
    /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