diff -ru libxml2.orig/relaxng.c libxml2/relaxng.c
--- libxml2.orig/relaxng.c	2016-05-23 00:25:25.000000000 -0700
+++ libxml2/relaxng.c	2016-10-04 09:29:20.724251500 -0700
@@ -2088,6 +2088,7 @@
                          const xmlChar * arg2)
 {
     char msg[1000];
+    xmlChar *result;
 
     if (arg1 == NULL)
         arg1 = BAD_CAST "";
@@ -2215,7 +2216,7 @@
         snprintf(msg, 1000, "Unknown error code %d\n", err);
     }
     msg[1000 - 1] = 0;
-    xmlChar *result = xmlCharStrdup(msg);
+    result = xmlCharStrdup(msg);
     return (xmlEscapeFormatString(&result));
 }
 
diff -ru libxml2.orig/xmlschemas.c libxml2/xmlschemas.c
--- libxml2.orig/xmlschemas.c	2016-05-23 00:25:25.000000000 -0700
+++ libxml2/xmlschemas.c	2016-10-04 09:32:15.826569356 -0700
@@ -3168,8 +3168,8 @@
 		"valid.");
 	}
 	if (expected) {
-	    msg = xmlStrcat(msg, BAD_CAST " Expected is '");
 	    xmlChar *expectedEscaped = xmlCharStrdup(expected);
+	    msg = xmlStrcat(msg, BAD_CAST " Expected is '");
 	    msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped));
 	    FREE_AND_NULL(expectedEscaped);
 	    msg = xmlStrcat(msg, BAD_CAST "'.\n");
