From: Tom Tromey <tromey@redhat.com>
To: Ali Lakhia <lakhia@alumni.utexas.net>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Memory leak fixes
Date: Wed, 06 Oct 2010 16:19:00 -0000 [thread overview]
Message-ID: <m3pqvnqoov.fsf@fleche.redhat.com> (raw)
In-Reply-To: <AANLkTi=RR+7qnx4zcCsQa+PG2BqVjTW3O9y5Rmqdj=oA@mail.gmail.com> (Ali Lakhia's message of "Tue, 5 Oct 2010 16:47:00 -0700")
>>>>> "Ali" == Ali Lakhia <lakhia@alumni.utexas.net> writes:
Ali> I found the leak using a static checker. It is known to have false
Ali> positives! :-)
Ok, I suspected that might be the case.
Ali> do_cleanups (cleanup_chain);
Ali> + xfree (filename);
Tom> This one is also covered by a cleanup.
Ali> I don't see any cleanup calls. filename gets allocated by
Ali> build_address_symbolic() and nothing is freeing it as far as I can
Ali> tell.
Near the top of the function:
struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &name);
make_cleanup (free_current_contents, &filename);
This installs a cleanup that frees `name'. It is run by the do_cleanups
call at the end of the function.
I think the GDB internals manual has a section on "cleanups" and how
they interact with GDB's exception mechanism. An analyzer looking for
leaks has to know about this, because it is used pervasively throughout
GDB.
Tom
prev parent reply other threads:[~2010-10-06 16:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-02 0:16 Ali Lakhia
2010-10-02 0:57 ` Joel Brobecker
2010-10-05 22:47 ` Tom Tromey
2010-10-05 23:47 ` Ali Lakhia
2010-10-06 16:19 ` Tom Tromey [this message]
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=m3pqvnqoov.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lakhia@alumni.utexas.net \
/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