Re: [lxml-dev] fix for another memory leak

Narayan Desai schrieb:
I updated to the current svn, and it looks like this chunk didn't get committed. Is this intentional?
Oh, thanks for checking! :) It was by accident. It looked so much like the patch I had committed before the last one that I just thought you had copied it. I'll check it in as soon as I get to it. Thank you for taking care, Stefan
Index: src/lxml/etree.pyx =================================================================== --- src/lxml/etree.pyx (revision 23382) +++ src/lxml/etree.pyx (working copy) @@ -775,16 +775,18 @@
def __getitem__(self, key): cdef xmlNs* c_ns - cdef char* result + cdef char* cresult ns, tag = _getNsTag(key) if ns is None: - result = tree.xmlGetNoNsProp(self._c_node, tag) + cresult = tree.xmlGetNoNsProp(self._c_node, tag) else: - result = tree.xmlGetNsProp(self._c_node, tag, ns) - if result is NULL: + cresult = tree.xmlGetNsProp(self._c_node, tag, ns) + if cresult is NULL: # XXX free namespace that is not in use..? raise KeyError, key - return funicode(result) + result = funicode(cresult) + tree.xmlFree(cresult) + return result
def __len__(self): cdef int c
participants (1)
-
Stefan Behnel