schema compile BUGFIX compiled relics when recompiling context
types and extensions were not fully recompiled when the context is being
recompiled.
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 7b1b5c0..802ca58 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -1748,6 +1748,13 @@
break;
}
+ if (tctx->tpdf->type.compiled && (tctx->tpdf->type.compiled->refcount == 1)) {
+ /* context recompilation - everything was freed previously (the only reference is from the parsed type itself)
+ * and we need now recompile the type again in the updated context. */
+ lysc_type_free(ctx->ctx, tctx->tpdf->type.compiled);
+ ((struct lysp_tpdf *)tctx->tpdf)->type.compiled = NULL;
+ }
+
if (tctx->tpdf->type.compiled) {
/* it is not necessary to continue, the rest of the chain was already compiled,
* but we still may need to inherit default and units values, so start dummy loops */