plugins BUGFIX err structs must be initialized
diff --git a/src/plugins_types.c b/src/plugins_types.c
index 52cd4e2..63e83ac 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -315,6 +315,8 @@
{
LY_CHECK_ARG_RET(NULL, err, datatype, LY_EINVAL);
+ *err = NULL;
+
/* consume leading whitespaces */
for ( ; value_len && isspace(*value); ++value, --value_len) {}
@@ -338,6 +340,8 @@
{
LY_CHECK_ARG_RET(NULL, err, datatype, LY_EINVAL);
+ *err = NULL;
+
/* consume leading whitespaces */
for ( ; value_len && isspace(*value); ++value, --value_len) {}
@@ -366,6 +370,8 @@
size_t fraction = 0, size, len = 0, trailing_zeros;
int64_t d;
+ *err = NULL;
+
/* consume leading whitespaces */
for ( ; value_len && isspace(*value); ++value, --value_len) {}
@@ -460,6 +466,8 @@
LY_CHECK_ARG_RET(NULL, str, err, LY_EINVAL);
+ *err = NULL;
+
LY_ARRAY_FOR(patterns, u) {
/* match_data needs to be allocated each time because of possible multi-threaded evaluation */
match_data = pcre2_match_data_create_from_pattern(patterns[u]->code, NULL);
@@ -503,6 +511,7 @@
LY_ARRAY_COUNT_TYPE u;
ly_bool is_length; /* length or range */
+ *err = NULL;
is_length = (basetype == LY_TYPE_BINARY || basetype == LY_TYPE_STRING) ? 1 : 0;
LY_ARRAY_FOR(range->parts, u) {
@@ -607,6 +616,7 @@
{
LY_CHECK_ARG_RET(NULL, value || !value_len, err, LY_EINVAL);
+ *err = NULL;
if (!value) {
value = "";
}
@@ -680,6 +690,8 @@
LY_CHECK_ARG_RET(ctx, ctx, value, ctx_node, path, err, LY_EINVAL);
+ *err = NULL;
+
switch (format) {
case LY_PREF_SCHEMA:
case LY_PREF_SCHEMA_RESOLVED:
diff --git a/src/plugins_types_binary.c b/src/plugins_types_binary.c
index 4441ad4..b09bb92 100644
--- a/src/plugins_types_binary.c
+++ b/src/plugins_types_binary.c
@@ -44,6 +44,8 @@
LY_CHECK_ARG_RET(ctx, value, LY_EINVAL);
+ *err = NULL;
+
/* check hints */
ret = ly_type_check_hints(hints, value, value_len, type->basetype, NULL, err);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
diff --git a/src/plugins_types_bits.c b/src/plugins_types_bits.c
index 673a33b..152fdb5 100644
--- a/src/plugins_types_bits.c
+++ b/src/plugins_types_bits.c
@@ -40,8 +40,6 @@
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
-
- /* necessary variables */
LY_ERR ret = LY_SUCCESS;
struct lysc_type_bits *type_bits = (struct lysc_type_bits *)type;
struct lysc_type_bitenum_item **bits_items = NULL;
@@ -60,6 +58,8 @@
LY_ARRAY_COUNT_TYPE item_present_index;
LY_ARRAY_COUNT_TYPE it;
+ *err = NULL;
+
/* check hints */
ret = ly_type_check_hints(hints, value, value_len, type->basetype, NULL, err);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup_value);
diff --git a/src/plugins_types_boolean.c b/src/plugins_types_boolean.c
index 739faf8..c8c51b4 100644
--- a/src/plugins_types_boolean.c
+++ b/src/plugins_types_boolean.c
@@ -41,6 +41,8 @@
LY_ERR ret = LY_SUCCESS;
int8_t i;
+ *err = NULL;
+
/* check hints */
ret = ly_type_check_hints(hints, value, value_len, type->basetype, NULL, err);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
diff --git a/src/plugins_types_decimal64.c b/src/plugins_types_decimal64.c
index e5209eb..720aece 100644
--- a/src/plugins_types_decimal64.c
+++ b/src/plugins_types_decimal64.c
@@ -44,6 +44,8 @@
struct lysc_type_dec *type_dec = (struct lysc_type_dec *)type;
char buf[LY_NUMBER_MAXLEN];
+ *err = NULL;
+
if (!value || !value[0] || !value_len) {
ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid empty decimal64 value.");
goto cleanup;
diff --git a/src/plugins_types_empty.c b/src/plugins_types_empty.c
index c1bd099..1de6476 100644
--- a/src/plugins_types_empty.c
+++ b/src/plugins_types_empty.c
@@ -39,6 +39,8 @@
{
LY_ERR ret = LY_SUCCESS;
+ *err = NULL;
+
/* check hints */
ret = ly_type_check_hints(hints, value, value_len, type->basetype, NULL, err);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
diff --git a/src/plugins_types_enumeration.c b/src/plugins_types_enumeration.c
index 53eea3d..adcc953 100644
--- a/src/plugins_types_enumeration.c
+++ b/src/plugins_types_enumeration.c
@@ -41,6 +41,8 @@
LY_ARRAY_COUNT_TYPE u;
struct lysc_type_enum *type_enum = (struct lysc_type_enum *)type;
+ *err = NULL;
+
/* check hints */
ret = ly_type_check_hints(hints, value, value_len, type->basetype, NULL, err);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
diff --git a/src/plugins_types_identityref.c b/src/plugins_types_identityref.c
index ea165a7..f148368 100644
--- a/src/plugins_types_identityref.c
+++ b/src/plugins_types_identityref.c
@@ -66,6 +66,8 @@
struct lysc_ident *ident = NULL, *identities, *base;
ly_bool dyn;
+ *err = NULL;
+
/* check hints */
ret = ly_type_check_hints(hints, value, value_len, type->basetype, NULL, err);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
diff --git a/src/plugins_types_union.c b/src/plugins_types_union.c
index 5fe2522..0748567 100644
--- a/src/plugins_types_union.c
+++ b/src/plugins_types_union.c
@@ -40,6 +40,8 @@
return LY_EINVAL;
}
+ *err = NULL;
+
/* turn logging off */
prev_lo = ly_log_options(0);
@@ -91,6 +93,8 @@
struct lysc_type_union *type_u = (struct lysc_type_union *)type;
struct lyd_value_subvalue *subvalue = NULL;
+ *err = NULL;
+
/* prepare subvalue storage */
subvalue = calloc(1, sizeof *subvalue);
if (!subvalue) {