aboutsummaryrefslogtreecommitdiff
path: root/src/tool_cfgable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool_cfgable.c')
-rw-r--r--src/tool_cfgable.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index 6bcf421b3..aed96a48b 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -153,6 +153,21 @@ static void free_config_fields(struct Configurable *config)
void config_free(struct Configurable *config)
{
- free_config_fields(config);
- free(config);
+ struct Configurable *last = config;
+
+ /* Find the last config structure */
+ while(last->next)
+ last = last->next;
+
+ /* Free each of the structures in reverse order */
+ do {
+ struct Configurable *prev = last->prev;
+ if(prev)
+ last->easy = NULL;
+
+ free_config_fields(last);
+ free(last);
+
+ last = prev;
+ } while(last);
}