parser BUGFIX skip new validation on multi-error
Because it could cause auto-deletion, which in turn
invalid memory access.
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 93d2e84..3ea3684 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -845,8 +845,8 @@
LY_CHECK_ERR_GOTO(r, rc = r, cleanup);
}
- if (!(lydctx->parse_opts & LYD_PARSE_ONLY)) {
- /* new node validation, autodelete CANNOT occur, all nodes are new */
+ if (!(lydctx->parse_opts & LYD_PARSE_ONLY) && !rc) {
+ /* new node validation, autodelete CANNOT occur (it can if multi-error), all nodes are new */
r = lyd_validate_new(lyd_node_child_p(*node), snode, NULL, lydctx->val_opts, NULL);
LY_DPARSER_ERR_GOTO(r, rc = r, lydctx, cleanup);