json & schema_compile BUGFIX uninitialized variables

Fixes #1787
diff --git a/src/schema_compile.c b/src/schema_compile.c
index aeeb239..760c052 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -151,6 +151,13 @@
 {
     LY_ARRAY_COUNT_TYPE u;
 
+    if (instance_p) {
+        *instance_p = NULL;
+    }
+    if (cardinality_p) {
+        *cardinality_p = 0;
+    }
+
     LY_ARRAY_FOR(ext->substmts, u) {
         if (LY_STMT_IS_DATA_NODE(substmt)) {
             if (!LY_STMT_IS_DATA_NODE(ext->substmts[u].stmt)) {