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-31455: fix reference leak #6318
Conversation
…executing user code) with a live exception set. Backport to Py2.7
…rror handling fixes. This change generally splits the xmlparser creation code into an unsafe part with "rollback" error handling and a safe "object initialisation done" part with normal decref cleanup.
The travis build failure seems unrelated. The relevant tests had already passed by then. |
ALLOC(sizeof(XMLParserObject), "create expatparser"); | ||
|
||
/* Init to NULL to keep the error handling below manageable. */ | ||
self->target = |
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 is not needed. PyObject_New()
clears the memory.
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.
I thought so, too, until the test started crashing due to uninitalised struct fields.
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.
Oh, seems I remember this wrong.
ALLOC(sizeof(XMLParserObject), "create expatparser"); | ||
|
||
/* Init to NULL to keep the error handling below manageable. */ | ||
self->target = |
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.
Oh, seems I remember this wrong.
Seems the test is failed for unrelated cause. |
Fixes a reference leak to 'self' in the previous implementation.
https://bugs.python.org/issue31455