Re: [xml] calling xmlCleanupParser from a library considered harmful

On 5 Nov 2012, at 12:48, Michael Stahl wrote:

yes, that would probably be an improvement (or the ~equivalent of
replacing xmlCleanupParser with NOP and adding new xmlReallyCleanupStuff
suggested in the other mail).

Well, the *real* fix would be to give everyone an 'XmlContext' (preferably
provided as a totally opaque void *). These could maintained by libxml on
a list. At some future points, stuff requiring static storage might take
this as a parameter. Right now the XmlContext need not contain anything.
This will prevent an xmlFreeContext being called by the same user twice
from deiniting the library, as it can check the context is on the list

The current xmlinit/deinit calls can then create/free an internal item
static XmlContext on this list, with appropriate refcount checking (i.e.
per my previous suggestion).

Then the memdump can at least point out which library is not freeing stuff.

I don't see why apps should not do deinit stuff on atexit().

Alex Bligh

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]