From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Fix for PR 10736
Date: Wed, 31 Mar 2010 21:20:00 -0000 [thread overview]
Message-ID: <201003311814.43957.sergiodj@redhat.com> (raw)
In-Reply-To: <201003301144.25720.pedro@codesourcery.com>
Hi Pedro,
On Tuesday 30 March 2010 07:44:25, Pedro Alves wrote:
> > + /* Should we re-read the XML info for this target? */
> > + if (my_gdb_datadir && strcmp (my_gdb_datadir, gdb_datadir) != 0)
> > + {
> > + /* The data-directory changed from the last time we used it.
> > + It means that we have to re-read the XML info. */
> > + have_initialized_sysinfo = 0;
> > + xfree (my_gdb_datadir);
> > + my_gdb_datadir = NULL;
>
> The previous data dir is only released if the datadir changed.
>
> > + if (sysinfo)
> > + free_syscalls_info ((void *) sysinfo);
> > + }
> >
> > +
> > + /* Saving the data-directory used to read this XML info. */
> > + my_gdb_datadir = xstrdup (gdb_datadir);
>
> So here my_gdb_datadir leaks if the datadir _doesn't_ change.
> I think you just need to move the xfree and my_data_dir=NULL
> statements outside the `if', before the early return.
Sorry, I don't know if I understood. If the datadir doesn't change, the call
to xstrdup will only be made once (i.e., when `have_initialized_sysinfo' is
zero). After that, it will never be called again unless datadir changes.
Thanks,
--
Sergio Durigan Junior
Debugger Engineer
Red Hat Inc.
next prev parent reply other threads:[~2010-03-31 21:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-30 0:02 Sergio Durigan Junior
2010-03-30 0:03 ` Sergio Durigan Junior
2010-03-30 10:44 ` Pedro Alves
2010-03-31 21:20 ` Sergio Durigan Junior [this message]
2010-04-01 0:25 ` Pedro Alves
2010-04-05 15:59 ` Sergio Durigan Junior
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=201003311814.43957.sergiodj@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
/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