Skip to content
Snippets Groups Projects
Commit 6899ba22 authored by Ondřej Zajíček's avatar Ondřej Zajíček Committed by Maria Matejka
Browse files

Conf: Fix too early free of old configuration

The change 371eb490 introduced early free
of old_config. Unfortunately, it did not properly check whether it is not
still in use (blocked by obstacle during reconfiguration). Fix that.

It also means that we still could have a short peak when three configs
are in use (when a new reconfig is requeste while the previous one is
still active).
parent b8a230e4
No related branches found
No related tags found
No related merge requests found
......@@ -195,8 +195,12 @@ cleanup:
void
config_free(struct config *c)
{
if (c)
rfree(c->pool);
if (!c)
return;
ASSERT(!c->obstacle_count);
rfree(c->pool);
}
/**
......@@ -205,10 +209,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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment