diff --git a/ChangeLog b/ChangeLog index 7d0649cc..112c1b86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Fri Feb 8 10:54:09 CET 2008 Daniel Veillard + + * dict.c: applied patch from Florent Guilian to remove an + useless mutex in the xmlDict structure. + +Wed Feb 6 17:00:20 CET 2008 Daniel Veillard + + * SAX2.c: another leak reported by Ashwin + * xinclude.c: fixed the behaviour when XIncluding a fragment + of the current document, patch from Chris Ryan + Wed Feb 6 12:10:08 HKT 2008 William Brack * nanohttp.c: added space for port number (when not 80) in diff --git a/SAX2.c b/SAX2.c index 9739831c..7dbc2b22 100644 --- a/SAX2.c +++ b/SAX2.c @@ -2366,7 +2366,9 @@ xmlSAX2Reference(void *ctx, const xmlChar *name) 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); + } } /** diff --git a/dict.c b/dict.c index 3b4054f2..c071887f 100644 --- a/dict.c +++ b/dict.c @@ -60,7 +60,6 @@ struct _xmlDictStrings { */ struct _xmlDict { int ref_counter; - xmlRMutexPtr mutex; struct _xmlDictEntry *dict; int size; @@ -337,11 +336,8 @@ xmlDictCreate(void) { 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 @@ xmlDictFree(xmlDictPtr dict) { xmlFree(pool); pool = nextp; } - xmlFreeRMutex(dict->mutex); xmlFree(dict); } diff --git a/xinclude.c b/xinclude.c index 31ea0267..2310601a 100644 --- a/xinclude.c +++ b/xinclude.c @@ -516,9 +516,8 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { 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) { @@ -616,6 +615,19 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { return(-1); } + /* + * 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 */