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

(cherry picked from commit 0742abdc48886b74ed3b66985a54bb1c32802670)

Co-authored-by: TAGAMI Yukihiro <tagami.yukihiro@gmail.com>
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index ec68463..b3d9bdd 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -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);