schema tree CHANGE base for the printer tree's free function
diff --git a/src/tree_schema.c b/src/tree_schema.c
new file mode 100644
index 0000000..d9a5d32
--- /dev/null
+++ b/src/tree_schema.c
@@ -0,0 +1,31 @@
+/**
+ * @file tree_schema.c
+ * @author Radek Krejci <rkrejci@cesnet.cz>
+ * @brief Schema tree implementation
+ *
+ * Copyright (c) 2015 - 2018 CESNET, z.s.p.o.
+ *
+ * This source code is licensed under BSD 3-Clause License (the "License").
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://opensource.org/licenses/BSD-3-Clause
+ */
+
+#include "libyang.h"
+#include "common.h"
+
+API void
+lysp_module_free(struct lysp_module *module)
+{
+ struct ly_ctx *ctx;
+
+ LY_CHECK_ARG_RET(NULL, module,);
+ ctx = module->ctx;
+
+ lydict_remove(ctx, module->name);
+ lydict_remove(ctx, module->ns);
+ lydict_remove(ctx, module->prefix);
+
+ free(module);
+}
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 1b33060..382f681 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -674,6 +674,13 @@
};
/**
+ * @brief Free the printable YANG schema tree structure.
+ *
+ * @param[in] module Printable YANG schema tree structure to free.
+ */
+void lysp_module_free(struct lysp_module *module);
+
+/**
* @brief Compiled YANG schema tree structure representing YANG module.
*
* Semantically validated YANG schema tree for data tree parsing.