Fixing two stupid bugs on entities and HTML tree deallocation, Daniel.
diff --git a/entities.c b/entities.c
index 2cedf92..54be393 100644
--- a/entities.c
+++ b/entities.c
@@ -260,6 +260,15 @@
 		(!xmlStrcmp(cur->name, name))) return(cur);
 	}
     }
+    if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
+	table = (xmlEntitiesTablePtr) doc->extSubset->entities;
+	for (i = 0;i < table->nb_entities;i++) {
+	    cur = &table->table[i];
+	    if (((cur->type ==  XML_INTERNAL_PARAMETER_ENTITY) ||
+	         (cur->type ==  XML_EXTERNAL_PARAMETER_ENTITY)) &&
+		(!xmlStrcmp(cur->name, name))) return(cur);
+	}
+    }
     return(NULL);
 }
 
@@ -317,6 +326,15 @@
 	        (!xmlStrcmp(cur->name, name))) return(cur);
 	}
     }
+    if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
+	table = (xmlEntitiesTablePtr) doc->extSubset->entities;
+	for (i = 0;i < table->nb_entities;i++) {
+	    cur = &table->table[i];
+	    if ((cur->type !=  XML_INTERNAL_PARAMETER_ENTITY) &&
+	        (cur->type !=  XML_EXTERNAL_PARAMETER_ENTITY) &&
+	        (!xmlStrcmp(cur->name, name))) return(cur);
+	}
+    }
     if (xmlPredefinedEntities == NULL)
         xmlInitializePredefinedEntities();
     table = xmlPredefinedEntities;