trees BUGFIX checking failure of the called functions
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index c5f3a79..e11815b 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -256,6 +256,7 @@
case LYD_ANYDATA_LYB:
if (value->mem) {
len = lyd_lyb_data_length(value->mem);
+ LY_CHECK_RET(len == -1, LY_EINVAL);
t->value.mem = malloc(len);
LY_CHECK_ERR_RET(!t->value.mem, LOGMEM(LYD_NODE_CTX(trg)), LY_EMEM);
memcpy(t->value.mem, value->mem, len);
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 0b88687..b958df4 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -772,6 +772,7 @@
break;
default:
LOGERR(ctx, LY_EINVAL, "Invalid schema input format.");
+ ret = LY_EINVAL;
break;
}
LY_CHECK_GOTO(ret, error);