This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Lucas Cimon
Recipients Lucas Cimon
Date 2019-01-11.19:14:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547234042.68.0.95184796304.issue35720@roundup.psfhosted.org>
In-reply-to
Content
Hi.

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.

Regards.
History
Date User Action Args
2019-01-11 19:14:05Lucas Cimonsetrecipients: + Lucas Cimon
2019-01-11 19:14:02Lucas Cimonsetmessageid: <1547234042.68.0.95184796304.issue35720@roundup.psfhosted.org>
2019-01-11 19:14:02Lucas Cimonlinkissue35720 messages
2019-01-11 19:14:02Lucas Cimoncreate