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)
|
if (current_key->resource)
|
||||||
rval->resource = strdup(current_key->resource);
|
rval->resource = strdup(current_key->resource);
|
||||||
|
else rval->resource = NULL;
|
||||||
|
|
||||||
return (void *) rval;
|
return (void *) rval;
|
||||||
}
|
}
|
||||||
|
@ -1926,6 +1926,7 @@ dcb_maybe_add_persistent(DCB *dcb)
|
|||||||
&& !(dcb->flags & DCBF_HUNG)
|
&& !(dcb->flags & DCBF_HUNG)
|
||||||
&& (poolcount = dcb_persistent_clean_count(dcb, false)) < dcb->server->persistpoolmax)
|
&& (poolcount = dcb_persistent_clean_count(dcb, false)) < dcb->server->persistpoolmax)
|
||||||
{
|
{
|
||||||
|
DCB_CALLBACK *loopcallback;
|
||||||
LOGIF(LD, (skygw_log_write(
|
LOGIF(LD, (skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"%lu [dcb_maybe_add_persistent] Adding DCB to persistent pool, user %s.\n",
|
"%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);
|
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);
|
spinlock_acquire(&dcb->server->persistlock);
|
||||||
dcb->nextpersistent = dcb->server->persistent;
|
dcb->nextpersistent = dcb->server->persistent;
|
||||||
dcb->server->persistent = dcb;
|
dcb->server->persistent = dcb;
|
||||||
|
@ -762,7 +762,11 @@ char buf[40];
|
|||||||
key = keyread(fd);
|
key = keyread(fd);
|
||||||
value = valueread(fd);
|
value = valueread(fd);
|
||||||
if (key == NULL || value == NULL)
|
if (key == NULL || value == NULL)
|
||||||
|
{
|
||||||
|
free(key);
|
||||||
|
free(value);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
hashtable_add(table, key, value);
|
hashtable_add(table, key, value);
|
||||||
rval++;
|
rval++;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ char *password;
|
|||||||
maxscaled->username = strndup(GWBUF_DATA(head), GWBUF_LENGTH(head));
|
maxscaled->username = strndup(GWBUF_DATA(head), GWBUF_LENGTH(head));
|
||||||
maxscaled->state = MAXSCALED_STATE_PASSWD;
|
maxscaled->state = MAXSCALED_STATE_PASSWD;
|
||||||
dcb_printf(dcb, "PASSWORD");
|
dcb_printf(dcb, "PASSWORD");
|
||||||
gwbuf_consume(head, GWBUF_LENGTH(head));
|
while ((head = gwbuf_consume(head, GWBUF_LENGTH(head))) != NULL);
|
||||||
break;
|
break;
|
||||||
case MAXSCALED_STATE_PASSWD:
|
case MAXSCALED_STATE_PASSWD:
|
||||||
password = strndup(GWBUF_DATA(head), GWBUF_LENGTH(head));
|
password = strndup(GWBUF_DATA(head), GWBUF_LENGTH(head));
|
||||||
@ -170,7 +170,7 @@ char *password;
|
|||||||
dcb_printf(dcb, "FAILED");
|
dcb_printf(dcb, "FAILED");
|
||||||
maxscaled->state = MAXSCALED_STATE_LOGIN;
|
maxscaled->state = MAXSCALED_STATE_LOGIN;
|
||||||
}
|
}
|
||||||
gwbuf_consume(head, GWBUF_LENGTH(head));
|
while ((head = gwbuf_consume(head, GWBUF_LENGTH(head))) != NULL);
|
||||||
free(password);
|
free(password);
|
||||||
break;
|
break;
|
||||||
case MAXSCALED_STATE_DATA:
|
case MAXSCALED_STATE_DATA:
|
||||||
@ -182,7 +182,7 @@ char *password;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Force the free of the buffer header
|
// 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 &&
|
if (dcb->session->state == SESSION_STATE_ROUTER_READY &&
|
||||||
dcb->session->client != NULL &&
|
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,
|
client_protocol = SESSION_PROTOCOL(dcb->session,
|
||||||
MySQLProtocol);
|
MySQLProtocol);
|
||||||
|
Reference in New Issue
Block a user