Added missing freeing of monitor resources
Monitor servers were not freed.
This commit is contained in:
@ -62,6 +62,8 @@ const monitor_def_t monitor_event_definitions[MAX_MONITOR_EVENT] =
|
|||||||
static MONITOR *allMonitors = NULL;
|
static MONITOR *allMonitors = NULL;
|
||||||
static SPINLOCK monLock = SPINLOCK_INIT;
|
static SPINLOCK monLock = SPINLOCK_INIT;
|
||||||
|
|
||||||
|
static void monitor_servers_free(MONITOR_SERVERS *servers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a new monitor, load the associated module for the monitor
|
* Allocate a new monitor, load the associated module for the monitor
|
||||||
* and start execution on the monitor.
|
* and start execution on the monitor.
|
||||||
@ -139,6 +141,7 @@ monitor_free(MONITOR *mon)
|
|||||||
}
|
}
|
||||||
spinlock_release(&monLock);
|
spinlock_release(&monLock);
|
||||||
free_config_parameter(mon->parameters);
|
free_config_parameter(mon->parameters);
|
||||||
|
monitor_servers_free(mon->databases);
|
||||||
free(mon->name);
|
free(mon->name);
|
||||||
free(mon);
|
free(mon);
|
||||||
}
|
}
|
||||||
@ -253,6 +256,24 @@ monitorAddServer(MONITOR *mon, SERVER *server)
|
|||||||
spinlock_release(&mon->lock);
|
spinlock_release(&mon->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free monitor server list
|
||||||
|
* @param servers Servers to free
|
||||||
|
*/
|
||||||
|
static void monitor_servers_free(MONITOR_SERVERS *servers)
|
||||||
|
{
|
||||||
|
while (servers)
|
||||||
|
{
|
||||||
|
MONITOR_SERVERS *tofree = servers;
|
||||||
|
servers = servers->next;
|
||||||
|
if (tofree->con)
|
||||||
|
{
|
||||||
|
mysql_close(tofree->con);
|
||||||
|
}
|
||||||
|
free(tofree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a default user to the monitor. This user is used to connect to the
|
* Add a default user to the monitor. This user is used to connect to the
|
||||||
* monitored databases but may be overriden on a per server basis.
|
* monitored databases but may be overriden on a per server basis.
|
||||||
|
Reference in New Issue
Block a user