1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Conf: Free stored old config before parsing new one

BIRD keeps a previous (old) configuration for the purpose of undo. The
existing code frees it after a new configuration is successfully parsed
during reconfiguration. That causes memory usage spikes as there are
temporarily three configurations (old, current, and new). The patch
changes it to free the old one before parsing the new one (as user
already requested a new config). The disadvantage is that undo is
not available after failed reconfiguration.
This commit is contained in:
Ondrej Zajicek
2022-11-09 21:09:16 +01:00
parent 84545a26cc
commit 371eb49043
4 changed files with 27 additions and 0 deletions

View File

@@ -242,6 +242,8 @@ async_config(void)
{
struct config *conf;
config_free_old();
log(L_INFO "Reconfiguration requested by SIGHUP");
if (!unix_read_config(&conf, config_name))
{
@@ -324,6 +326,8 @@ cmd_reconfig(const char *name, int type, uint timeout)
if (cli_access_restricted())
return;
config_free_old();
struct config *conf = cmd_read_config(name);
if (!conf)
return;