summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2014-07-26 21:04:54 +0800
committerDaniel Veillard <veillard@redhat.com>2014-07-26 21:04:54 +0800
commit42870f46ccf36f83a55fde03344657d360ba0793 (patch)
treeb47a3875f2a4ab7e002a2467bf90755be88fede2
parent2f9b126a5c39bc7ba14384d4f79479ba05c81239 (diff)
downloadlibxml2-42870f46ccf36f83a55fde03344657d360ba0793.tar.gz
Add couple of missing Null checks
For https://bugzilla.gnome.org/show_bug.cgi?id=733710 Reported by Gaurav but with slightly different fixes
-rw-r--r--relaxng.c7
-rw-r--r--tree.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/relaxng.c b/relaxng.c
index 57ae972b..8d88e957 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -6652,12 +6652,17 @@ xmlRelaxNGParseDocument(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
ctxt->define = NULL;
if (IS_RELAXNG(node, "grammar")) {
schema->topgrammar = xmlRelaxNGParseGrammar(ctxt, node->children);
+ if (schema->topgrammar == NULL) {
+ xmlRelaxNGFree(schema);
+ return (NULL);
+ }
} else {
xmlRelaxNGGrammarPtr tmp, ret;
schema->topgrammar = ret = xmlRelaxNGNewGrammar(ctxt);
if (schema->topgrammar == NULL) {
- return (schema);
+ xmlRelaxNGFree(schema);
+ return (NULL);
}
/*
* Link the new grammar in the tree
diff --git a/tree.c b/tree.c
index 7853e35f..7d414817 100644
--- a/tree.c
+++ b/tree.c
@@ -4514,6 +4514,10 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) {
#ifdef LIBXML_TREE_ENABLED
if (doc->intSubset != NULL) {
ret->intSubset = xmlCopyDtd(doc->intSubset);
+ if (ret->intSubset == NULL) {
+ xmlFreeDoc(ret);
+ return(NULL);
+ }
xmlSetTreeDoc((xmlNodePtr)ret->intSubset, ret);
ret->intSubset->parent = ret;
}