This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fix for PR 10736
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>
- Date: Tue, 30 Mar 2010 11:44:25 +0100
- Subject: Re: Fix for PR 10736
- References: <201003292101.48377.sergiodj@redhat.com>
On Tuesday 30 March 2010 01:01:47, Sergio Durigan Junior wrote:
> Hello guys,
>
> The following patch is a fix for PR 10736.
Thanks!
> OK?
Almost. There's just a leak to fix.
> + /* 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.
Anyway, okay with this leak fixed.
--
Pedro Alves