[gdome] Memory Leak in the Xpath Module



Hi

In gdome Xpath there is a memory leak problem when the node returned by the gdome_xpath_xpresult_singleNodeValue() is a Namespace

Declaration node.

Reason- gdome_xpath_xpresult_singleNodeValue()calls the gdome_xml_n_mkref() to obtain an reference to the node to be

       returned. In side the gdome_xml_n_mkref() for a namespace declaration type node gdome_xml_xpns_mkref()is called

       that creates  node which is of type Gdome_xml_XPathNamespace. In side the gdome_xml_xpns_mkref()

       a node of type xmlNode is created with the namespace as passed to the gdome_xml_xpns_mkref(). This node address is

       stored in the "n" field of the Gdome_xml_XPathNamespace structure. As there is not separate API to unref the

       Gdome_xml_XPathNamespace object gdome_n_unref() is called that actually calls the gdome_xml_n_unref(). In that

       function the structure of type Gdome_xml_XPathNamespace is type casted to Gdome_xml_Node. After the reference count

       is decremented it is checked for 0 along with the listener list field (ll) for NULL. As the Gdome_xml_XPathNamespace

       don't have any listener list field(ll) the ll field of the type casted object has some garbage value that causes the condition

       to be false and the xmlNode object is not freed along with the Gdome_xml_XPathNamespace object.



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