bpo-45329: Fix freed memory access in pyexpat.c (GH-28649)

This commit is contained in:
TAGAMI Yukihiro 2021-10-02 18:57:13 +09:00 committed by GitHub
parent 417faa69bd
commit 0742abdc48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
Fix freed memory access in :class:`pyexpat.xmlparser` when building it with an
installed expat library <= 2.2.0.

View file

@ -1204,10 +1204,10 @@ static void
xmlparse_dealloc(xmlparseobject *self)
{
PyObject_GC_UnTrack(self);
(void)xmlparse_clear(self);
if (self->itself != NULL)
XML_ParserFree(self->itself);
self->itself = NULL;
(void)xmlparse_clear(self);
if (self->handlers != NULL) {
PyMem_Free(self->handlers);