Fix to #473, http://bugs.skysql.com/show_bug.cgi?id=473

Several memory issues. Read the code.
In general one-off hint is only added to gwbuf and freed in gwbuf_free. Stacked hint is copied to stack and to gwbuf. gwbuf is freed after routing but stacked hint is freed either in stop or when session is closed. All this applies to named hint as well except that in addition, it has one more copy in named hint struct which is emptied when session is closed.
This commit is contained in:
VilhoRaatikka
2014-08-08 01:28:07 +03:00
parent 183428c48b
commit 86a4c3ba90
7 changed files with 208 additions and 24 deletions

View File

@ -422,7 +422,6 @@ static int gw_read_backend_event(DCB *dcb) {
GWBUF *read_buffer = NULL;
ROUTER_OBJECT *router = NULL;
ROUTER *router_instance = NULL;
void *rsession = NULL;
SESSION *session = dcb->session;
int nbytes_read = 0;
@ -787,7 +786,7 @@ static int gw_error_backend_event(DCB *dcb)
* closed by router and COM_QUIT sent or there was an error which
* have already been handled.
*/
if (dcb->session != DCB_STATE_POLLING)
if (dcb->state != DCB_STATE_POLLING)
{
return 1;
}