Fix a couple of missing NULL checks

For https://bugzilla.gnome.org/show_bug.cgi?id=708681
diff --git a/tree.c b/tree.c
index b517a2c..b0c1372 100644
--- a/tree.c
+++ b/tree.c
@@ -4299,6 +4299,7 @@
 	    }
 	    if (doc->intSubset == NULL) {
 		q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
+		if (q == NULL) return(NULL);
 		q->doc = doc;
 		q->parent = parent;
 		doc->intSubset = (xmlDtdPtr) q;
@@ -4310,6 +4311,7 @@
 	} else
 #endif /* LIBXML_TREE_ENABLED */
 	    q = xmlStaticCopyNode(node, doc, parent, 1);
+	if (q == NULL) return(NULL);
 	if (ret == NULL) {
 	    q->prev = NULL;
 	    ret = p = q;