instid BUGFIX do not compile path for schema default values
Because it causes issues when freeing the modules,
depending on the order, freed nodes may be accessed.
diff --git a/src/schema_compile.c b/src/schema_compile.c
index fde3128..bb83147 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -963,6 +963,12 @@
}
LY_ATOMIC_INC_BARRIER(((struct lysc_type *)storage->realtype)->refcount);
+ if (storage->realtype->basetype == LY_TYPE_INST) {
+ /* ly_path includes references to other nodes, in case they are in foreign modules, the context would
+ * need to be freed in specific order to avoid accessing freed memory, so just avoid storing it */
+ ly_path_free(storage->target);
+ storage->target = NULL;
+ }
return LY_SUCCESS;
}