This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] main,c, captured_main, close memory leak (python)
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Doug Evans <dje at google dot com>
- Date: Mon, 7 Mar 2011 15:26:41 +0400
- Subject: Re: [RFA] main,c, captured_main, close memory leak (python)
- References: <4D740BD0.1050905@vmware.com>
> OK Doug?
>
> 2011-03-06 Michael Snyder <msnyder@vmware.com>
>
> * main.c (captured_main): Fix memory leak.
FWIW, it looks correct to me. Let's wait for Doug's opinion, though.
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/main.c,v
> retrieving revision 1.92
> diff -u -p -r1.92 main.c
> --- main.c 9 Jan 2011 03:20:33 -0000 1.92
> +++ main.c 6 Mar 2011 22:31:09 -0000
> @@ -352,11 +352,14 @@ captured_main (void *data)
> GDB_DATADIR_RELOCATABLE);
>
> #ifdef WITH_PYTHON_PATH
> - /* For later use in helping Python find itself. */
> - python_libdir = relocate_directory (argv[0],
> - concat (WITH_PYTHON_PATH,
> - SLASH_STRING, "lib", NULL),
> - PYTHON_PATH_RELOCATABLE);
> + {
> + /* For later use in helping Python find itself. */
> + char *tmp = concat (WITH_PYTHON_PATH, SLASH_STRING, "lib", NULL);
> +
> + python_libdir = relocate_directory (argv[0], tmp,
> + PYTHON_PATH_RELOCATABLE);
> + xfree (tmp);
> + }
> #endif
>
> #ifdef RELOC_SRCDIR
--
Joel