Re: [xml] segmentation fault

On Thu, Apr 01, 2010 at 10:23:57AM -0400, Oswalt, Ed (GE Healthcare) wrote:
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:                 _doc = libxml2.parseFile(
self.__dataFile )
                _ctxt = _doc.xpathNewContext()             _xpath =
"/ERROR_TABLE/ROW[ code=\"%s\"]/@msg" % code             _parms = _ctxt.xpathEval( _xpath )
       --- modulename: libxml2, funcname: freeDoc

here you are freeing the document  ...         libxml2mod.xmlFreeDoc(self._o)             _ctxt.xpathFreeContext()
       --- modulename: libxml2, funcname: xpathFreeContext
                for _pm in _parms:                 return (code,_pm.content)
       --- modulename: libxml2, funcname: get_content         return
      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 Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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