GNOME Bugzilla – Bug 165349
Memory leak when using python validation error handlers
Last modified: 2009-08-15 18:40:50 UTC
Please describe the problem: The python bindings have a small memory leak id you register error handlers with setValidityErrorHandler(). The problem is that the xmlValidCtxtPyCtxt structure does not get freed in the (autogenerated) libxml_xmlFreeValidCtxt. I believe the correct fix is to write a libxml_xmlFreeValidCtxt that frees that structure. I'll attach a testcase and patch. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 36568 [details] Test-case to show memory leak
Created attachment 36569 [details] [review] Patch to fix leak
Hmm. Schemas seem to have the same problem....
Okay reproduced, I applied your patch and it fixed it, thanks ! Could you also submidt a patch for the case of schemas ? sorry it took so long, I lost track of it, thanks ! Daniel
Created attachment 39414 [details] [review] Schema handlers leak patch Patch to fix memory leak when freeing schema error handlers
Reopening to submit the patch for the schema case. Interesting enough, the code was already there, but #if'd out. I have another schema error handler patch for python, but I'll put that in a separate bug.
Okay, applied ! I just made the function static, this is now commited in CVS, thanks a lot, Daniel
This should be closed by release of libxml2-2.6.21, thanks, Daniel