aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/python/python.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index af1608d..eb6d062 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-09 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * python/python.c (do_start_initialization): Make progname_copy static,
+ to avoid a leak report.
+
2019-09-08 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (box_win): Truncate long window titles.
diff --git a/gdb/python/python.c b/gdb/python/python.c
index b309ae9..9c49151 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1590,7 +1590,14 @@ do_start_initialization ()
{
#ifdef IS_PY3K
size_t progsize, count;
- wchar_t *progname_copy;
+ /* Python documentation indicates that the memory given
+ to Py_SetProgramName cannot be freed. However, it seems that
+ at least Python 3.7.4 Py_SetProgramName takes a copy of the
+ given program_name. Making progname_copy static and not release
+ the memory avoids a leak report for Python versions that duplicate
+ program_name, and respect the requirement of Py_SetProgramName
+ for Python versions that do not duplicate program_name. */
+ static wchar_t *progname_copy;
#endif
#ifdef WITH_PYTHON_PATH