MXS-1539: Actually assign the allocated member pointer
The memory for the rate limit struct was allocated but it was not assigned for the service. Also corrected a false debug assertion in service_refresh_users.
This commit is contained in:
@ -103,8 +103,8 @@ SERVICE* service_alloc(const char *name, const char *router)
|
|||||||
char *my_name = MXS_STRDUP(name);
|
char *my_name = MXS_STRDUP(name);
|
||||||
char *my_router = MXS_STRDUP(router);
|
char *my_router = MXS_STRDUP(router);
|
||||||
SERVICE *service = (SERVICE *)MXS_CALLOC(1, sizeof(*service));
|
SERVICE *service = (SERVICE *)MXS_CALLOC(1, sizeof(*service));
|
||||||
SERVICE_REFRESH_RATE* rate_limit = (SERVICE_REFRESH_RATE*)MXS_CALLOC(config_threadcount(),
|
SERVICE_REFRESH_RATE* rate_limits = (SERVICE_REFRESH_RATE*)MXS_CALLOC(config_threadcount(),
|
||||||
sizeof(*rate_limit));
|
sizeof(*rate_limits));
|
||||||
if (!my_name || !my_router || !service)
|
if (!my_name || !my_router || !service)
|
||||||
{
|
{
|
||||||
MXS_FREE(my_name);
|
MXS_FREE(my_name);
|
||||||
@ -151,6 +151,7 @@ SERVICE* service_alloc(const char *name, const char *router)
|
|||||||
service->routerOptions = NULL;
|
service->routerOptions = NULL;
|
||||||
service->log_auth_warnings = true;
|
service->log_auth_warnings = true;
|
||||||
service->strip_db_esc = true;
|
service->strip_db_esc = true;
|
||||||
|
service->rate_limits = rate_limits;
|
||||||
if (service->name == NULL || service->routerModule == NULL)
|
if (service->name == NULL || service->routerModule == NULL)
|
||||||
{
|
{
|
||||||
if (service->name)
|
if (service->name)
|
||||||
@ -1608,7 +1609,7 @@ int service_refresh_users(SERVICE *service)
|
|||||||
{
|
{
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int self = mxs_worker_get_current_id();
|
int self = mxs_worker_get_current_id();
|
||||||
ss_dassert(self);
|
ss_dassert(self >= 0);
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
/* Check if refresh rate limit has been exceeded */
|
/* Check if refresh rate limit has been exceeded */
|
||||||
|
Reference in New Issue
Block a user