dict BUGFIX revert ffeedfdbce0dd98d30cba9738b1800bac483cefb
This optimization exposes another bug that it is not
possible to solve properly without NBC changes so
wait with it until a new SO version.
diff --git a/src/path.c b/src/path.c
index 3876762..9a77414 100644
--- a/src/path.c
+++ b/src/path.c
@@ -708,7 +708,7 @@
/* store the value */
LOG_LOCSET(key, NULL);
- ret = lyd_value_store(ctx_node->module->ctx, &p->value, ((struct lysc_node_leaf *)key)->type, val, val_len, 0, 0,
+ ret = lyd_value_store(ctx, &p->value, ((struct lysc_node_leaf *)key)->type, val, val_len, 0, 0,
NULL, format, prefix_data, LYD_HINT_DATA, key, NULL);
LOG_LOCBACK(1, 0);
LY_CHECK_ERR_GOTO(ret, p->value.realtype = NULL, cleanup);
@@ -736,7 +736,7 @@
/* names (keys) are unique - it was checked when parsing */
LOGVAL(ctx, LYVE_XPATH, "Predicate missing for a key of %s \"%s\" in path.",
lys_nodetype2str(ctx_node->nodetype), ctx_node->name);
- ly_path_predicates_free(ctx_node->module->ctx, *predicates);
+ ly_path_predicates_free(ctx, *predicates);
*predicates = NULL;
ret = LY_EVALID;
goto cleanup;
@@ -771,10 +771,12 @@
}
/* store the value */
- LOG_LOCSET(ctx_node, NULL);
- ret = lyd_value_store(ctx_node->module->ctx, &p->value, ((struct lysc_node_leaflist *)ctx_node)->type, val, val_len, 0, 0,
+ if (ctx_node) {
+ LOG_LOCSET(ctx_node, NULL);
+ }
+ ret = lyd_value_store(ctx, &p->value, ((struct lysc_node_leaflist *)ctx_node)->type, val, val_len, 0, 0,
NULL, format, prefix_data, LYD_HINT_DATA, ctx_node, NULL);
- LOG_LOCBACK(1, 0);
+ LOG_LOCBACK(ctx_node ? 1 : 0, 0);
LY_CHECK_ERR_GOTO(ret, p->value.realtype = NULL, cleanup);
++(*tok_idx);
@@ -1091,7 +1093,7 @@
}
lref = (const struct lysc_type_leafref *)deref_leaf_node->type;
LY_CHECK_GOTO(ret = ly_path_append(ctx, path2, path), cleanup);
- ly_path_free(path2);
+ ly_path_free(ctx, path2);
path2 = NULL;
/* compile dereferenced leafref expression and append it to the path */
@@ -1099,7 +1101,7 @@
&path2), cleanup);
node2 = path2[LY_ARRAY_COUNT(path2) - 1].node;
LY_CHECK_GOTO(ret = ly_path_append(ctx, path2, path), cleanup);
- ly_path_free(path2);
+ ly_path_free(ctx, path2);
path2 = NULL;
/* properly parsed path must always continue with ')' and '/' */
@@ -1123,9 +1125,9 @@
LY_CHECK_GOTO(ret = ly_path_append(ctx, path2, path), cleanup);
cleanup:
- ly_path_free(path2);
+ ly_path_free(ctx, path2);
if (ret) {
- ly_path_free(*path);
+ ly_path_free(ctx, *path);
*path = NULL;
}
return ret;
@@ -1281,7 +1283,7 @@
cleanup:
if (ret) {
- ly_path_free(*path);
+ ly_path_free(ctx, *path);
*path = NULL;
}
LOG_LOCBACK(cur_node ? 1 : 0, 0);
@@ -1486,7 +1488,7 @@
}
void
-ly_path_free(struct ly_path *path)
+ly_path_free(const struct ly_ctx *ctx, struct ly_path *path)
{
LY_ARRAY_COUNT_TYPE u;
@@ -1495,7 +1497,7 @@
}
LY_ARRAY_FOR(path, u) {
- ly_path_predicates_free(path[u].node->module->ctx, path[u].predicates);
+ ly_path_predicates_free(ctx, path[u].predicates);
}
LY_ARRAY_FREE(path);
}