libxml2 r3686 - trunk



Author: veillard
Date: Fri Feb  8 09:56:31 2008
New Revision: 3686
URL: http://svn.gnome.org/viewvc/libxml2?rev=3686&view=rev

Log:
* dict.c: applied patch from Florent Guilian to remove an
  useless mutex in the xmlDict structure.

older, not commited ...

* SAX2.c: another leak reported by Ashwin
* xinclude.c: fixed the behaviour when XIncluding a fragment
  of the current document, patch from Chris Ryan

Daniel



Modified:
   trunk/ChangeLog
   trunk/SAX2.c
   trunk/dict.c
   trunk/xinclude.c

Modified: trunk/SAX2.c
==============================================================================
--- trunk/SAX2.c	(original)
+++ trunk/SAX2.c	Fri Feb  8 09:56:31 2008
@@ -2366,7 +2366,9 @@
     xmlGenericError(xmlGenericErrorContext,
 	    "add xmlSAX2Reference %s to %s \n", name, ctxt->node->name);
 #endif
-    xmlAddChild(ctxt->node, ret);
+    if (xmlAddChild(ctxt->node, ret) == NULL) {
+        xmlFreeNode(ret);
+    }
 }
 
 /**

Modified: trunk/dict.c
==============================================================================
--- trunk/dict.c	(original)
+++ trunk/dict.c	Fri Feb  8 09:56:31 2008
@@ -60,7 +60,6 @@
  */
 struct _xmlDict {
     int ref_counter;
-    xmlRMutexPtr mutex;
 
     struct _xmlDictEntry *dict;
     int size;
@@ -337,11 +336,8 @@
 	dict->strings = NULL;
 	dict->subdict = NULL;
         if (dict->dict) {
-            if ((dict->mutex = xmlNewRMutex()) != NULL) {
-                memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
-                return(dict);
-            }
-            xmlFree(dict->dict);
+	    memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
+	    return(dict);
         }
         xmlFree(dict);
     }
@@ -545,7 +541,6 @@
 	xmlFree(pool);
 	pool = nextp;
     }
-    xmlFreeRMutex(dict->mutex);
     xmlFree(dict);
 }
 

Modified: trunk/xinclude.c
==============================================================================
--- trunk/xinclude.c	(original)
+++ trunk/xinclude.c	Fri Feb  8 09:56:31 2008
@@ -516,9 +516,8 @@
 	href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */
 	if (href == NULL) 
 	    return(-1);
-	local = 1;
     }
-    if (href[0] == '#')
+    if ((href[0] == '#') || (href[0] == 0))
 	local = 1;
     parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE);
     if (parse != NULL) {
@@ -617,6 +616,19 @@
     }
 
     /*
+     * If local and xml then we need a fragment
+     */
+    if ((local == 1) && (xml == 1) &&
+        ((fragment == NULL) || (fragment[0] == 0))) {
+	xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_RECURSION,
+	               "detected a local recursion with no xpointer in %s\n",
+		       URL);
+	if (fragment != NULL)
+	    xmlFree(fragment);
+	return(-1);
+    }
+
+    /*
      * Check the URL against the stack for recursions
      */
     if ((!local) && (xml == 1)) {



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