tree schema BUGFIX unlinking derived identities on error

Fixes #1808
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index a5ff013..a62f273 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -809,8 +809,10 @@
  * @brief Free the schema structure. It just frees, it does not remove the schema from its context.
  *
  * @param[in,out] module Schema module structure to free.
+ * @param[in] remove_links Whether to remove links in other modules to structures in this module. Not needed if
+ * the whole context is being freed.
  */
-void lys_module_free(struct lys_module *module);
+void lys_module_free(struct lys_module *module, ly_bool remove_links);
 
 /**
  * @brief match yang keyword