This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] python: Fix memleak in do_start_initialization
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> There's already a comment in that regard:
Hah, I totally missed this.
Simon> When I read it, I thought it referred only to progname_copy, but it
Simon> also applies to progname for Python 2. I integrated your suggestion,
Simon> wdyt?
Simon> - char *progname;
Simon> + gdb::unique_xmalloc_ptr<char> progname;
I think the patch looks good, but would be even clearer if this
declaration were moved into the #if, so that..
Simon> - progname = concat (ldirname (python_libdir).c_str (), SLASH_STRING, "bin",
Simon> - SLASH_STRING, "python", (char *) NULL);
Simon> + progname.reset (concat (ldirname (python_libdir).c_str (), SLASH_STRING,
Simon> + "bin", SLASH_STRING, "python", (char *) NULL));
...this reset could be replaced with plain initialization.
thanks,
Tom