[RFA] Fix leak detected in python.c initialization code.

Tom Tromey tom@tromey.com
Mon Sep 9 16:39:00 GMT 2019


>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> So, it looks like 3.7.4 Python duplicates its argument, which explains
Philippe> the leak found by Valgrind.
Philippe> It looks better to respect the doc and not have GDB freeing the string
Philippe> given to Py_SetProgramName, and avoid the leak error by declaring
Philippe> the progname_copy static.
Philippe> This will work with Python versions that really use this string without
Philippe> duplicating it, and avoids a leak report for Python version that duplicates
Philippe> it.

I think something along these lines should be put into a comment just
before the declaration.  This is ok with that change.

thanks,
Tom



More information about the Gdb-patches mailing list