- tree.c: applied Steve Tinney patch to xmlNewNsProp to fix bug #55810
Daniel
diff --git a/ChangeLog b/ChangeLog
index cdc645b..2882684 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun  7 21:52:10 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+	* tree.c: applied Steve Tinney patch to xmlNewNsProp to fix
+	  bug #55810
+
 Thu Jun  7 21:29:39 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
 	* tree.c: fixed xmlGetNsProp() to close bug #55683
diff --git a/tree.c b/tree.c
index 0cd65ad..0f10673 100644
--- a/tree.c
+++ b/tree.c
@@ -1042,6 +1042,7 @@
 xmlNewNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
            const xmlChar *value) {
     xmlAttrPtr cur;
+    xmlDocPtr doc = NULL;
 
     if (name == NULL) {
 #ifdef DEBUG_TREE
@@ -1064,16 +1065,18 @@
     cur->type = XML_ATTRIBUTE_NODE;
 
     cur->parent = node; 
-    if (node != NULL)
-	cur->doc = node->doc; 
+    if (node != NULL) {
+	doc = node->doc;
+	cur->doc = doc;
+    }
     cur->ns = ns;
     cur->name = xmlStrdup(name);
     if (value != NULL) {
 	xmlChar *buffer;
 	xmlNodePtr tmp;
 
-	buffer = xmlEncodeEntitiesReentrant(node->doc, value);
-	cur->children = xmlStringGetNodeList(node->doc, buffer);
+	buffer = xmlEncodeEntitiesReentrant(doc, value);
+	cur->children = xmlStringGetNodeList(doc, buffer);
 	cur->last = NULL;
 	tmp = cur->children;
 	while (tmp != NULL) {