I wonder whether the real issue here isn't that we have some functions
that invoke libxml without ultimately doing xmlCleanupParser() ---
xml_in being the first obvious candidate. Maybe that is the mechanism
through which libxml ends up with dangling pointers.
regards, tom lane