Fix crash when multiple MySQL monitors monitor same servers

The monitors always freed and reallocated the memory for the slaves. It
was always of the same size so a static array of that size should also
work.
This commit is contained in:
Markus Makela
2016-09-08 09:46:46 +03:00
parent 4940e1482f
commit a474dad753
4 changed files with 7 additions and 12 deletions

View File

@ -45,6 +45,7 @@
*/
#define MAX_SERVER_NAME_LEN 1024
#define MAX_NUM_SLAVES 128 /**< Maximum number of slaves under a single server*/
/**
* The server parameters used for weighting routing decissions
@ -99,7 +100,7 @@ typedef struct server
SERVER_PARAM *parameters; /**< Parameters of a server that may be used to weight routing decisions */
long master_id; /**< Master server id of this node */
int depth; /**< Replication level in the tree */
long *slaves; /**< Slaves of this node */
long slaves[MAX_NUM_SLAVES]; /**< Slaves of this node */
bool master_err_is_logged; /*< If node failed, this indicates whether it is logged */
DCB *persistent; /**< List of unused persistent connections to the server */
SPINLOCK persistlock; /**< Lock for adjusting the persistent connections list */