Skip to content

Commit 35ca182

Browse files
Lucas-Cvstinner
authored andcommitted
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.
1 parent 9932a22 commit 35ca182

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a minor memory leak in pymain_parse_cmdline_impl function in Modules/main.c

Modules/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config,
13761376
goto done;
13771377
}
13781378
pymain_clear_cmdline(pymain, cmdline);
1379+
pymain_clear_pymain(pymain);
13791380
memset(cmdline, 0, sizeof(*cmdline));
13801381
config->utf8_mode = new_utf8_mode;
13811382
config->coerce_c_locale = new_coerce_c_locale;

0 commit comments

Comments
 (0)