Heads-Up: Beware of xmlCleanupParser() when your package links against libxml2

Lennart Poettering mzerqung at 0pointer.de
Tue Jan 12 23:21:15 UTC 2010


if you have code that links against libxml2 and calls
xmlCleanupParser() please verify that your project does that at the
appropriate place (i.e. immediately before exiting, and only once).

That function might delete TLS fields that belong to other libraries
(such as PA's client libs) if called twice. To the effect that PA
might look bad. And I don't like that.

So, please: if you have a library linking against libxml2, verify that
xmlCleanupParser() is called at the appropriate places and only once.

For now at least Empathy and Abiword are calling this function where
they shouldn't, but a google code search reveals that at least
inkscape and dia do it too. I stopped looking after that,
extrapolating that this means "everyone is doing this worng". Hence
this mail.

For more information see:


I also asked that libxml2 warns directly about this misuse:


Thanks to Michal Schmidt for tracking this down. 


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

More information about the devel mailing list