Config utils improvement
Added a function to free resources allocated by config node tree.
Change-Id: I2ee8ae642899ec4501fa6e490c5be7efaa2d738e
diff --git a/libcutils/config_utils.c b/libcutils/config_utils.c
index 75fa6c6..fc5ca78 100644
--- a/libcutils/config_utils.c
+++ b/libcutils/config_utils.c
@@ -315,3 +315,15 @@
data = load_file(fn, 0);
config_load(root, data);
}
+
+void config_free(cnode *root)
+{
+ cnode *cur = root->first_child;
+
+ while (cur) {
+ cnode *prev = cur;
+ config_free(cur);
+ cur = cur->next;
+ free(prev);
+ }
+}