data BUGFIX adding default nodes into data tree when parsing
In case the data from a specific module was not present, the default
data nodes from such a module were created, but not connected with the
original data tree, causing not only incorrect data tree, but also
memory leaks.
@@ -339,7 +339,7 @@ lyd_parse_data(const struct ly_ctx *ctx, struct ly_in *in, LYD_FORMAT format, ui
if (!mod) {
break;
}
- if (first == *tree) {
+ if (!first || first == *tree) {
/* make sure first2 changes are carried to tree */
first2 = tree;
} else {
