diff --git a/ChangeLog b/ChangeLog index ae61093b..7e8e0b64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 2 18:18:27 PDT 2004 William Brack + + * parser.c: fixed problem with dictionary handling within + xmlParseInNodeContext (bug 153175) + Sat Oct 2 15:46:37 PDT 2004 William Brack * check-relaxng-test-suite.py, check-relaxng-test-suite2.py, diff --git a/parser.c b/parser.c index 47102708..e1523c05 100644 --- a/parser.c +++ b/parser.c @@ -10974,13 +10974,20 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, return(XML_ERR_NO_MEMORY); } xmlAddChild(node, fake); - - xmlCtxtUseOptions(ctxt, options); + + /* + * Use input doc's dict if present, else assure XML_PARSE_NODICT is set. + * We need a dictionary for xmlDetectSAX2, so if there's no doc dict + * we must wait until the last moment to free the original one. + */ if (doc->dict != NULL) { - if (ctxt->dict != NULL) + if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); ctxt->dict = doc->dict; - } + } else + options |= XML_PARSE_NODICT; + + xmlCtxtUseOptions(ctxt, options); xmlDetectSAX2(ctxt); ctxt->myDoc = doc; @@ -11070,7 +11077,9 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, xmlFreeNodeList(*lst); *lst = NULL; } - + + if ((doc->dict == NULL) && (ctxt->dict != NULL)) + xmlDictFree(ctxt->dict); ctxt->dict = NULL; xmlFreeParserCtxt(ctxt);