Kaydet (Commit) 35ca1820 authored tarafından Lucas Cimon's avatar Lucas Cimon Kaydeden (comit) Victor Stinner

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.
üst 9932a228
Fixed a minor memory leak in pymain_parse_cmdline_impl function in Modules/main.c
\ No newline at end of file
...@@ -1376,6 +1376,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config, ...@@ -1376,6 +1376,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config,
goto done; goto done;
} }
pymain_clear_cmdline(pymain, cmdline); pymain_clear_cmdline(pymain, cmdline);
pymain_clear_pymain(pymain);
memset(cmdline, 0, sizeof(*cmdline)); memset(cmdline, 0, sizeof(*cmdline));
config->utf8_mode = new_utf8_mode; config->utf8_mode = new_utf8_mode;
config->coerce_c_locale = new_coerce_c_locale; config->coerce_c_locale = new_coerce_c_locale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment