summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-01-22 16:42:13 (GMT)
committerGitHub <noreply@github.com>2019-01-22 16:42:13 (GMT)
commitf71e7433ebccb2e3a2665b93bb84de38f9c581c8 (patch)
tree522105aefeb64dbed034655de9d22a60569201b5
parentd1dd6be613381b996b9071443ef081de8e5f3aff (diff)
downloadcpython-f71e7433ebccb2e3a2665b93bb84de38f9c581c8.zip
cpython-f71e7433ebccb2e3a2665b93bb84de38f9c581c8.tar.gz
cpython-f71e7433ebccb2e3a2665b93bb84de38f9c581c8.tar.bz2
bpo-35720: Fixing a memory leak in pymain_parse_cmdline_impl() (GH-11528)
When the loop in the pymain_read_conf function in this same file calls pymain_init_cmdline_argv() a 2nd time, the pymain->command buffer of wchar_t is overriden and the previously allocated memory is never freed. (cherry picked from commit 35ca1820e19f81f69073f294503cdcd708fe490f) Co-authored-by: Lucas Cimon <lucas.cimon@gmail.com>
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2019-01-12-23-33-04.bpo-35720.LELKQx.rst1
-rw-r--r--Modules/main.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-01-12-23-33-04.bpo-35720.LELKQx.rst b/Misc/NEWS.d/next/Core and Builtins/2019-01-12-23-33-04.bpo-35720.LELKQx.rst
new file mode 100644
index 0000000..9c57ebc
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-01-12-23-33-04.bpo-35720.LELKQx.rst
@@ -0,0 +1 @@
+Fixed a minor memory leak in pymain_parse_cmdline_impl function in Modules/main.c \ No newline at end of file
diff --git a/Modules/main.c b/Modules/main.c
index af2c191..a745381 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -2165,6 +2165,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config, _PyCmdline *cmdline)
goto done;
}
pymain_clear_cmdline(pymain, cmdline);
+ pymain_clear_pymain(pymain);
memset(cmdline, 0, sizeof(*cmdline));
cmdline_get_global_config(cmdline);