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
Py_FrozenMain() resource leak and missing malloc checks #60097
Comments
In Python/frozenmain.c the function Py_FrozenMain() doesn't handle argv_copy and argv_copy2 correctly. Both variables contain memory that is allocated with PyMem_Malloc(). argv_copy2 is never checked for NULL and both variables are not correctly cleaned up in error cases. CID 486834: Resource leak (RESOURCE_LEAK)At (11): Variable "argv_copy" going out of scope leaks the storage it points to. Suggested fix: |
Patch against hg tip attached. |
New changeset ab8121466785 by Victor Stinner in branch '3.3': New changeset 386ab2c12301 by Victor Stinner in branch 'default': |
New changeset 47c6aa17fd90 by Victor Stinner in branch 'default': |
New changeset 12af9db5212a by Victor Stinner in branch '3.3': |
I didn't know Py_FrozenMain(). I upgraded it to use the same code than main(). Should I backport my fixes to Python 3.3 (except maybe 0001c4100823 which is risky). |
Victor, is here anything left to do? |
This believe that this can be closed as Python 3.3 is no longer taking fixes. |
The bug is correctly fixed in default. I don't really care of fixing such warning of static analyzer in older Python versions. It's more a theorical bug, it's a small memory leak and only occur if another error occurs. I just close the issue. |
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: