libxml2 r3706 - trunk



Author: veillard
Date: Fri Mar 14 10:54:00 2008
New Revision: 3706
URL: http://svn.gnome.org/viewvc/libxml2?rev=3706&view=rev

Log:
* parser.c xinclude.c: patch from Vasily Chekalkin fixes memory
  leaks, should fix 512647
Daniel


Modified:
   trunk/ChangeLog
   trunk/parser.c
   trunk/xinclude.c

Modified: trunk/parser.c
==============================================================================
--- trunk/parser.c	(original)
+++ trunk/parser.c	Fri Mar 14 10:54:00 2008
@@ -12376,7 +12376,6 @@
                         int recovery, void *data) {
     xmlDocPtr ret;
     xmlParserCtxtPtr ctxt;
-    char *directory = NULL;
 
     xmlInitParser();
 
@@ -12394,10 +12393,8 @@
 	ctxt->_private = data;
     }
 
-    if ((ctxt->directory == NULL) && (directory == NULL))
-        directory = xmlParserGetDirectory(filename);
-    if ((ctxt->directory == NULL) && (directory != NULL))
-        ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
+    if (ctxt->directory == NULL)
+        ctxt->directory = xmlParserGetDirectory(filename);
 
     ctxt->recovery = recovery;
 

Modified: trunk/xinclude.c
==============================================================================
--- trunk/xinclude.c	(original)
+++ trunk/xinclude.c	Fri Mar 14 10:54:00 2008
@@ -419,7 +419,6 @@
 xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) {
     xmlDocPtr ret;
     xmlParserCtxtPtr pctxt;
-    char *directory = NULL;
     xmlParserInputPtr inputStream;
 
     xmlInitParser();
@@ -456,10 +455,8 @@
 
     inputPush(pctxt, inputStream);
 
-    if ((pctxt->directory == NULL) && (directory == NULL))
-        directory = xmlParserGetDirectory(URL);
-    if ((pctxt->directory == NULL) && (directory != NULL))
-        pctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
+    if (pctxt->directory == NULL)
+        pctxt->directory = xmlParserGetDirectory(URL);
 
     pctxt->loadsubset |= XML_DETECT_IDS;
 



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