parser yang BUGFIX parsing path in type statement

Added deletion from dictionary in case of error.
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 0880269..4c76d43 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -2150,9 +2150,16 @@
                 return LY_EVALID;
             }
 
-            LY_CHECK_RET(parse_text_field(ctx, LY_STMT_PATH, 0, &str_path, Y_STR_ARG, &type->exts));
+            /* Usually, in the parser_yang.c, the result of the parsing is stored directly in the
+             * corresponding structure, so in case of failure, the lysp_module_free function will take
+             * care of removing the parsed value from the dictionary. But in this case, it is not possible
+             * to rely on lysp_module_free because the result of the parsing is stored in a local variable.
+             */
+            LY_CHECK_ERR_RET(ret = parse_text_field(ctx, LY_STMT_PATH, 0, &str_path, Y_STR_ARG, &type->exts),
+                    lydict_remove(PARSER_CTX(ctx), str_path), ret);
             ret = ly_path_parse(PARSER_CTX(ctx), NULL, str_path, 0, LY_PATH_BEGIN_EITHER, LY_PATH_LREF_TRUE,
                     LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &type->path);
+            /* Moreover, even if successful, the string is removed from the dictionary. */
             lydict_remove(PARSER_CTX(ctx), str_path);
             LY_CHECK_RET(ret);
             type->flags |= LYS_SET_PATH;