Re: [xml] segmentation fault



On Thu, Apr 01, 2010 at 10:23:57AM -0400, Oswalt, Ed (GE Healthcare) wrote:
Hi,
I am tracing the cause of a segmentation fault, apparently in the
libxml2 module.
My application is purely python and uses the libxml2 library for simple
data file look-up.
 
The core file is useless as it just indicates the main module name and a
physical memory address that has not meaning to me.
 
The python trace module produces the following:
 

      ErrCode.py(43):                 _doc = libxml2.parseFile(
self.__dataFile )
      
      ErrCode.py(47):             _ctxt = _doc.xpathNewContext()
      ErrCode.py(51):             _xpath =
"/ERROR_TABLE/ROW[ code=\"%s\"]/@msg" % code
      ErrCode.py(53):             _parms = _ctxt.xpathEval( _xpath )
      
      ErrCode.py(56):             _doc.freeDoc()
       --- modulename: libxml2, funcname: freeDoc

here you are freeing the document  ...

      libxml2.py(4079):         libxml2mod.xmlFreeDoc(self._o)
      ErrCode.py(57):             _ctxt.xpathFreeContext()
       --- modulename: libxml2, funcname: xpathFreeContext
      libxml2.py(6849):
libxml2mod.xmlXPathFreeContext(self._o)
      
      ErrCode.py(64):             for _pm in _parms:
      ErrCode.py(65):                 return (code,_pm.content)
       --- modulename: libxml2, funcname: get_content
      libxml2.py(267):         return
libxml2mod.xmlNodeGetContent(self._o)
      Segmentation fault

  holding the content you are trying to manipulate at this point.

XPath queries return pointers into the document tree. Don't free the
tree until you are still accessing it.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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