parser json BUGFIX log node memory leak
diff --git a/src/parser_json.c b/src/parser_json.c
index 82df659..3b90783 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -743,6 +743,7 @@
     assert(snode || node);
 
     nodetype = snode ? snode->nodetype : LYS_CONTAINER;
+    LOG_LOCSET(snode, NULL, NULL, NULL);
 
     /* move to the second item in the name/X pair */
     ret = lyjson_ctx_next(lydctx->jsonctx, &status);
@@ -799,14 +800,13 @@
         LY_CHECK_GOTO(status != LYJSON_OBJECT, representation_error);
         break;
     default:
-        LOGINT_RET(ctx);
+        LOGINT(ctx);
+        ret = LY_EINT;
+        goto cleanup;
     }
 
     /* process all the members inside a single metadata object */
     assert(status == LYJSON_OBJECT);
-
-    LOG_LOCSET(snode, NULL, NULL, NULL);
-
     while (status != LYJSON_OBJECT_CLOSED) {
         LY_CHECK_GOTO(status != LYJSON_OBJECT, representation_error);
 
@@ -897,7 +897,6 @@
             "The attribute(s) of %s \"%s\" is expected to be represented as JSON %s, but input data contains @%s/%s.",
             lys_nodetype2str(nodetype), node ? LYD_NAME(node) : LYD_NAME(prev), expected, lyjson_token2str(status),
             in_parent ? "" : "name");
-
     ret = LY_EVALID;
 
 cleanup: