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 christian.heimes
Recipients christian.heimes
Date 2012-09-09.22:09:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347228598.43.0.424519630485.issue15893@psf.upfronthosting.co.za>
In-reply-to
Content
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. 
CID 486835: Resource leak (RESOURCE_LEAK)At (9): Variable "argv_copy2" going out of scope leaks the storage it points to.

Suggested fix:
Separate var declaration from PyMem_Malloc() calls and use a goto label to clean up the variables and its content at the end of the function.
History
Date User Action Args
2012-09-09 22:09:58christian.heimessetrecipients: + christian.heimes
2012-09-09 22:09:58christian.heimessetmessageid: <1347228598.43.0.424519630485.issue15893@psf.upfronthosting.co.za>
2012-09-09 22:09:57christian.heimeslinkissue15893 messages
2012-09-09 22:09:57christian.heimescreate