Source

perl-XML-LibXML / xpath.c

Diff from to

File xpath.c

 
 xmlXPathObjectPtr
 domXPathFind( xmlNodePtr refNode, xmlChar * path ) {
-    xmlNodeSetPtr rv ;
     xmlXPathObjectPtr res = NULL;
-    void * xslt_lib;
-    char * error;
-  
-    rv = xmlXPathNodeSetCreate( 0 );
   
     if ( refNode != NULL && refNode->doc != NULL && path != NULL ) {
         /* we can only do a path in a valid document! 
             ctxt->nsNr++;
         }
 
-        xmlXPathRegisterFunc(ctxt, (const xmlChar *) "document",
-            perlDocumentFunction);
+        xmlXPathRegisterFunc(ctxt,
+                             (const xmlChar *) "document",
+                             perlDocumentFunction);
+       
 
         comp = xmlXPathCompile( path );
         if (comp != NULL) {
             xmlXPathFreeCompExpr(comp);
         }
 
+        if (ctxt->namespaces != NULL) {
+            xmlFree( ctxt->namespaces );
+        }
+
         xmlXPathFreeContext(ctxt);
     }
     return res;
     xmlNodeSetPtr rv ;
     xmlXPathObjectPtr res;
   
-    rv = xmlXPathNodeSetCreate( 0 );
-    
     res = domXPathFind( refNode, path );
     
     if (res != NULL) {
         	   not kill it */
         rv = res->nodesetval;  
         res->nodesetval = 0 ;
-    
     }
 
     xmlXPathFreeObject(res);