summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Gupta <g.gupta@samsung.com>2014-08-07 11:19:03 +0800
committerDaniel Veillard <veillard@redhat.com>2014-08-07 11:19:03 +0800
commit658b86c0eaacefb0999873efb883c7e50c628d18 (patch)
treead7745eaac99f6b2d52280eaaa6d3bbdf5d0c8c7
parent1db9969966aac1e844372e9b3288653a296e0365 (diff)
downloadlibxml2-658b86c0eaacefb0999873efb883c7e50c628d18.tar.gz
Couple of Missing Null checks
For https://bugzilla.gnome.org/show_bug.cgi?id=734328 Missing Null check could cause crash, if a pointer is dereferenced. Found problem at two places in valid.c
-rw-r--r--valid.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/valid.c b/valid.c
index 1e03a7c7..409aa81d 100644
--- a/valid.c
+++ b/valid.c
@@ -1798,6 +1798,7 @@ xmlCopyEnumeration(xmlEnumerationPtr cur) {
if (cur == NULL) return(NULL);
ret = xmlCreateEnumeration((xmlChar *) cur->name);
+ if (ret == NULL) return(NULL);
if (cur->next != NULL) ret->next = xmlCopyEnumeration(cur->next);
else ret->next = NULL;
@@ -6996,6 +6997,9 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names,
* Creates a dummy node and insert it into the tree
*/
test_node = xmlNewDocNode (ref_node->doc, NULL, BAD_CAST "<!dummy?>", NULL);
+ if (test_node == NULL)
+ return(-1);
+
test_node->parent = parent;
test_node->prev = prev;
test_node->next = next;