You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-01-22.16:43:52.001>created_at=<Date2019-01-11.19:14:02.668>labels= ['3.7', '3.8', 'performance']
title='Memory leak in Modules/main.c:pymain_parse_cmdline_impl when using the CLI flag'updated_at=<Date2019-01-22.16:43:52.000>user='https://github.com/Lucas-C'
I think I have found a minor memory leak in Modules/main.c:pymain_parse_cmdline_impl.
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.
I haven't written any code test to reproduce this,
but it can be tested easily with gdb:
gdb -- bin/python3 -c pass
start
b Modules/main.c:587
b pymain_clear_pymain
c
c
You'll see that PyMem_RawMalloc is called twice without pymain->command ever being freed in pymain_clear_pymain.
I have a patch coming as PR on GitHub
I'd be glad to have your feedback on this issue and my proposal for a fix.
New changeset 35ca182 by Victor Stinner (Lucas Cimon) in branch 'master': bpo-35720: Fixing a memory leak in pymain_parse_cmdline_impl() (GH-11528) 35ca182
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: