diff -Naur a/valid.c b/valid.c
--- a/valid.c	2013-09-19 17:28:12.000000000 +0530
+++ b/valid.c	2013-09-19 17:29:36.000000000 +0530
@@ -5236,7 +5236,7 @@
     xmlElementContentPtr cont;
     const xmlChar *name;
 
-    if ((elemDecl == NULL) || (parent == NULL))
+    if ((elemDecl == NULL) || (parent == NULL) || (ctxt == NULL))
 	return(-1);
     cont = elemDecl->content;
     name = elemDecl->name;
