Guarantee router session is present for call to clientReply; properly free callbacks; attempt to set all necessary values for dbusers; do more to ensure buffers freed.
This commit is contained in:
@ -1782,6 +1782,7 @@ static void *uh_keydup(void* key) {
|
||||
|
||||
if (current_key->resource)
|
||||
rval->resource = strdup(current_key->resource);
|
||||
else rval->resource = NULL;
|
||||
|
||||
return (void *) rval;
|
||||
}
|
||||
|
@ -1926,6 +1926,7 @@ dcb_maybe_add_persistent(DCB *dcb)
|
||||
&& !(dcb->flags & DCBF_HUNG)
|
||||
&& (poolcount = dcb_persistent_clean_count(dcb, false)) < dcb->server->persistpoolmax)
|
||||
{
|
||||
DCB_CALLBACK *loopcallback;
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [dcb_maybe_add_persistent] Adding DCB to persistent pool, user %s.\n",
|
||||
@ -1946,7 +1947,13 @@ dcb_maybe_add_persistent(DCB *dcb)
|
||||
session_free(local_session);
|
||||
}
|
||||
}
|
||||
dcb->callbacks = NULL;
|
||||
spinlock_acquire(&dcb->cb_lock);
|
||||
while ((loopcallback = dcb->callbacks) != NULL)
|
||||
{
|
||||
dcb->callbacks = loopcallback->next;
|
||||
free(loopcallback);
|
||||
}
|
||||
spinlock_release(&dcb->cb_lock);
|
||||
spinlock_acquire(&dcb->server->persistlock);
|
||||
dcb->nextpersistent = dcb->server->persistent;
|
||||
dcb->server->persistent = dcb;
|
||||
|
@ -762,7 +762,11 @@ char buf[40];
|
||||
key = keyread(fd);
|
||||
value = valueread(fd);
|
||||
if (key == NULL || value == NULL)
|
||||
{
|
||||
free(key);
|
||||
free(value);
|
||||
break;
|
||||
}
|
||||
hashtable_add(table, key, value);
|
||||
rval++;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ char *password;
|
||||
maxscaled->username = strndup(GWBUF_DATA(head), GWBUF_LENGTH(head));
|
||||
maxscaled->state = MAXSCALED_STATE_PASSWD;
|
||||
dcb_printf(dcb, "PASSWORD");
|
||||
gwbuf_consume(head, GWBUF_LENGTH(head));
|
||||
while ((head = gwbuf_consume(head, GWBUF_LENGTH(head))) != NULL);
|
||||
break;
|
||||
case MAXSCALED_STATE_PASSWD:
|
||||
password = strndup(GWBUF_DATA(head), GWBUF_LENGTH(head));
|
||||
@ -170,7 +170,7 @@ char *password;
|
||||
dcb_printf(dcb, "FAILED");
|
||||
maxscaled->state = MAXSCALED_STATE_LOGIN;
|
||||
}
|
||||
gwbuf_consume(head, GWBUF_LENGTH(head));
|
||||
while ((head = gwbuf_consume(head, GWBUF_LENGTH(head))) != NULL);
|
||||
free(password);
|
||||
break;
|
||||
case MAXSCALED_STATE_DATA:
|
||||
@ -182,7 +182,7 @@ char *password;
|
||||
else
|
||||
{
|
||||
// Force the free of the buffer header
|
||||
gwbuf_consume(head, 0);
|
||||
while ((head = gwbuf_consume(head, GWBUF_LENGTH(head))) != NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +569,8 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
*/
|
||||
if (dcb->session->state == SESSION_STATE_ROUTER_READY &&
|
||||
dcb->session->client != NULL &&
|
||||
dcb->session->client->state == DCB_STATE_POLLING)
|
||||
dcb->session->client->state == DCB_STATE_POLLING &&
|
||||
session->router_session)
|
||||
{
|
||||
client_protocol = SESSION_PROTOCOL(dcb->session,
|
||||
MySQLProtocol);
|
||||
|
Reference in New Issue
Block a user