Skip to content

Commit

Permalink
bpo-35720: Fixing a memory leak in pymain_parse_cmdline_impl() (GH-11528
Browse files Browse the repository at this point in the history
)

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 35ca182)

Co-authored-by: Lucas Cimon <lucas.cimon@gmail.com>
  • Loading branch information
miss-islington and Lucas-C committed Jan 22, 2019
1 parent d1dd6be commit f71e743
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
@@ -0,0 +1 @@
Fixed a minor memory leak in pymain_parse_cmdline_impl function in Modules/main.c
1 change: 1 addition & 0 deletions Modules/main.c
Expand Up @@ -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);
Expand Down

0 comments on commit f71e743

Please sign in to comment.