A few more safety cleanup raised by scan

* SAX2.c encoding.c parser.c xmlschemas.c: a few more safety checks
* relaxng.c: remove an unused intitialization
diff --git a/relaxng.c b/relaxng.c
index 351f03a..5146d9d 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -3470,6 +3470,9 @@
 {
     xmlChar *ret, *escape;
 
+    if (node == NULL)
+        return(NULL);
+
     if ((IS_RELAXNG(node, "data")) || (IS_RELAXNG(node, "value"))) {
         ret = xmlGetProp(node, BAD_CAST "datatypeLibrary");
         if (ret != NULL) {
@@ -6229,7 +6232,7 @@
                      xmlRelaxNGDefinePtr cur, int flags,
                      xmlRelaxNGType ptype)
 {
-    int nflags = flags;
+    int nflags;
     xmlRelaxNGContentType ret, tmp, val = XML_RELAXNG_CONTENT_EMPTY;
 
     while (cur != NULL) {