[xml] XPath Memory Leak

Date view Thread view Subject view Author view

From: Tim Ruddick (truddick@eng.us.uu.net)
Date: Thu Jul 13 2000 - 16:03:27 EDT


The XPath implementation has improved *dramatically* in v2.1.1! Many
thanks to whomever was responsible!

I noticed something in the xmlXPathFreeContext function, and I'm wondering
if there's a reason for it. The snippet of code that deallocates the
memory for the context nodeset is commented out. This means every call to
xmlXPathEval leaks at least 40 bytes (the size of the context->nodeTab
array). Should I be deallocating this memory outside of the FreeContext
function?

Context diffs below....

Tim.

*** ../libxml2-2.1.1/xpath.c Fri Jun 30 13:59:48 2000
--- xpath.c Thu Jul 13 15:57:07 2000
***************
*** 849,858 ****
      if (ctxt->namespaces != NULL)
          xmlFree(ctxt->namespaces);
  
- /***********
      if (ctxt->nodelist != NULL)
          xmlXPathFreeNodeSet(ctxt->nodelist);
! ***********/
  #ifdef DEBUG
      memset(ctxt, 0xB , (size_t) sizeof(xmlXPathContext));
  #endif
--- 849,857 ----
      if (ctxt->namespaces != NULL)
          xmlFree(ctxt->namespaces);
  
      if (ctxt->nodelist != NULL)
          xmlXPathFreeNodeSet(ctxt->nodelist);
!
  #ifdef DEBUG
      memset(ctxt, 0xB , (size_t) sizeof(xmlXPathContext));
  #endif

----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:22 EDT