json & schema_compile BUGFIX uninitialized variables

Fixes #1787
diff --git a/src/json.c b/src/json.c
index cbe38e9..59ae61c 100644
--- a/src/json.c
+++ b/src/json.c
@@ -963,7 +963,7 @@
 
     if (toplevel) {
         /* we are done */
-        return LY_SUCCESS;
+        goto result;
     }
 
     /* continue with the next token */