The recursive nature of this function made it difficult to free the root
node of the config tree. Splitting it in 2 allows to work around this
problem.
if (config_block != NULL)
{
if (config_block != NULL)
{
cjni_config_perform (config_block);
oconfig_free (config_block);
cjni_config_perform (config_block);
oconfig_free (config_block);
return (ci_copy);
} /* oconfig_item_t *oconfig_clone */
return (ci_copy);
} /* oconfig_item_t *oconfig_clone */
-void oconfig_free (oconfig_item_t *ci)
+void oconfig_free_all (oconfig_item_t *ci)
free (ci->values);
for (i = 0; i < ci->children_num; i++)
free (ci->values);
for (i = 0; i < ci->children_num; i++)
- oconfig_free (ci->children + i);
+ oconfig_free_all (ci->children + i);
if (ci->children != NULL)
free (ci->children);
}
if (ci->children != NULL)
free (ci->children);
}
+void oconfig_free (oconfig_item_t *ci)
+{
+ oconfig_free_all (ci);
+ free (ci);
+ ci = NULL;
+}
+
/*
* vim:shiftwidth=2:tabstop=8:softtabstop=2:fdm=marker
*/
/*
* vim:shiftwidth=2:tabstop=8:softtabstop=2:fdm=marker
*/