MXS-2183: Fix memory leaks

Under heavy load some of the basic network operations could fail which led
to some of the allocated memory to leak.

Also the backend protocol never freed the current protocol command if it
was not completed. This would happen if a user executed a session command
as the first command but backend authentication would fail.
This commit is contained in:
Markus Mäkelä
2018-11-28 01:33:16 +02:00
parent 24d1876ed4
commit 6451b1f21a
2 changed files with 16 additions and 3 deletions

View File

@ -105,6 +105,16 @@ bool mysql_protocol_done(DCB* dcb)
gwbuf_free(p->stored_query);
server_command_t* s = &p->protocol_command;
while (s->scom_next)
{
server_command_t tmp = *(s->scom_next);
MXS_FREE(s->scom_next);
p->protocol_command = tmp;
s = &p->protocol_command;
}
p->protocol_state = MYSQL_PROTOCOL_DONE;
rval = true;
}