diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 04:23:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 04:23:18 +0000 |
commit | b90161ccd3b318f3314a23cb10c387651ad35831 (patch) | |
tree | a47dc087160299ce02d728cbf031d84af6281537 /src/plugins_exts.c | |
parent | Adding upstream version 2.1.30. (diff) | |
download | libyang2-b90161ccd3b318f3314a23cb10c387651ad35831.tar.xz libyang2-b90161ccd3b318f3314a23cb10c387651ad35831.zip |
Adding upstream version 2.1.148.upstream/2.1.148upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/plugins_exts.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins_exts.c b/src/plugins_exts.c index 00970fa..f8cdeff 100644 --- a/src/plugins_exts.c +++ b/src/plugins_exts.c @@ -94,6 +94,8 @@ lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, const void *parsed, struct l ly_bool length_restr = 0; LY_DATA_TYPE basetype; + assert(parsed); + /* compilation wthout any storage */ if (substmt->stmt == LY_STMT_IF_FEATURE) { ly_bool enabled; @@ -106,8 +108,8 @@ lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, const void *parsed, struct l } } - if (!substmt->storage || !parsed) { - /* nothing to store or nothing parsed to compile */ + if (!substmt->storage) { + /* nothing to store */ goto cleanup; } @@ -268,6 +270,7 @@ lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, const void *parsed, struct l /* compile */ LY_CHECK_GOTO(rc = lys_compile_type(ctx, NULL, flags, ext->def->name, ptype, substmt->storage, &units, NULL), cleanup); + LY_ATOMIC_INC_BARRIER((*(struct lysc_type **)substmt->storage)->refcount); break; } case LY_STMT_EXTENSION_INSTANCE: { @@ -335,8 +338,8 @@ lyplg_ext_compile_extension_instance(struct lysc_ctx *ctx, const struct lysp_ext stmtp = extp->substmts[u].stmt; storagep = *(void **)extp->substmts[u].storage; - if (ly_set_contains(&storagep_compiled, storagep, NULL)) { - /* this parsed statement has already been compiled (for example, if it is a linked list of parsed nodes) */ + if (!storagep || ly_set_contains(&storagep_compiled, storagep, NULL)) { + /* nothing parsed or already compiled (for example, if it is a linked list of parsed nodes) */ continue; } |