mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Conf: Fix too early free of old configuration
The change 371eb49043
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).
This commit is contained in:
parent
ee91965894
commit
eefb296799
10
conf/conf.c
10
conf/conf.c
@ -197,7 +197,11 @@ cleanup:
|
||||
void
|
||||
config_free(struct config *c)
|
||||
{
|
||||
if (c)
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user