-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-35720: Fixing a memory leak in Modules/main.c:pymain_parse_cmdline_impl #11528
bpo-35720: Fixing a memory leak in Modules/main.c:pymain_parse_cmdline_impl #11528
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
The Travis CI build failed with:
The Azure Pipeline build failed because of a column in the
|
Modules/main.c
Outdated
@@ -435,7 +435,9 @@ pymain_clear_pymain(_PyMain *pymain) | |||
{ | |||
#define CLEAR(ATTR) \ | |||
do { \ | |||
PyMem_RawFree(ATTR); \ | |||
if (ATTR != NULL) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if is useless: PyMem_RawFree(NULL) does nothing, the call is safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, removed
Modules/main.c
Outdated
@@ -1381,7 +1383,8 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config, | |||
config->coerce_c_locale = new_coerce_c_locale; | |||
|
|||
/* The encoding changed: read again the configuration | |||
with the new encoding */ | |||
with the new encoding, but free allocated memory beforehand: */ | |||
pymain_clear_pymain(pymain); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the call after pymain_clear_cmdline() call a few lines before, and leave the comment unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done
@@ -0,0 +1,2 @@ | |||
The experimental PEP 554 data channels now correctly pass negative PyLong | |||
objects between subinterpreters on 32-bit systems. Patch by Michael Felt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems to be unrelated!? cc @aixtools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I included an extra commit by error. This is fixed now
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.
…nGH-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. (cherry picked from commit 35ca182) Co-authored-by: Lucas Cimon <[email protected]>
GH-11648 is a backport of this pull request to the 3.7 branch. |
) 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 <[email protected]>
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.
https://bugs.python.org/issue35720