summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/conf.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/conf/conf.c b/conf/conf.c
index 4e31de29..7ef729b3 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -197,8 +197,12 @@ cleanup:
void
config_free(struct config *c)
{
- if (c)
- rfree(c->pool);
+ if (!c)
+ return;
+
+ ASSERT(!c->obstacle_count);
+
+ rfree(c->pool);
}
/**
@@ -207,10 +211,14 @@ config_free(struct config *c)
* This function frees the old configuration (%old_config) that is saved for the
* purpose of undo. It is useful before parsing a new config when reconfig is
* requested, to avoid keeping three (perhaps memory-heavy) configs together.
+ * Configuration is not freed when it is still active during reconfiguration.
*/
void
config_free_old(void)
{
+ if (!old_config || old_config->obstacle_count)
+ return;
+
tm_stop(config_timer);
undo_available = 0;