XML parser BUGFIX incorrect preparation of data trees sized array for validation
diff --git a/src/parser_xml.c b/src/parser_xml.c
index ffb8567..8f625c7 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -306,11 +306,15 @@
/* finish incompletely validated terminal values */
for (unsigned int u = 0; u < xmlctx.incomplete_type_validation.count; u++) {
struct lyd_node_term *node = (struct lyd_node_term*)xmlctx.incomplete_type_validation.objs[u];
- struct lyd_node **trees = NULL, **tree;
- if (result) {
+ struct lyd_node **trees = NULL;
+
+ /* prepare sized array for validator */
+ if (*result) {
+ struct lyd_node **tree;
LY_ARRAY_NEW_RET(ctx, trees, tree, LY_EMEM);
*tree = *result;
}
+ /* validate and store the value of the node */
ret = lyd_value_parse(node, node->value.canonized, strlen(node->value.canonized), 0, lydxml_resolve_prefix, ctx, trees);
LY_ARRAY_FREE(trees);
if (ret) {