Re: [xml] Memleak in xmlNewReference


>  Damn, right, good spotting.



> You seems to have a really large test collection, are you using something

> public or a home grown one ?

It’s a mixture of both!


>  That doesn't seems the right approach, by freeing cur, there you

>change the semantic of the API, that doesn't look good to me. What should

> be done instead is check the return value of xmlAddChild() and if NULL

> then free the node in the caller. I think that call is done in SAX2.c

> at the end of xmlSAX2Reference() . I made that change and the leak is indeed

> fixed, I will commit this to SVN later.


I thought of fixing at the same place, but then decided to do it inside xmlAddChild because I thought it would take care of the problem at other places where the return value  is not checked, but I wasn’t really sure whether it was the right way to go about it.



>  Ideally all xmlAddChild() call in the library should be checked in that

> way, to avoid such problems. Maybe you could look at this at least in the

> most critical parts like the SAX2 and Include modules.

That's my next target ;)


And a big thanks to you and libxml, for the continued co-operation and help.





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