Fixed a memory leak in tee.c:freeSession, where tee session wasn't freed

This commit is contained in:
VilhoRaatikka
2014-12-23 13:36:05 +02:00
parent f0d8ed0cf2
commit 51315c0764
3 changed files with 12 additions and 4 deletions

View File

@ -458,6 +458,7 @@ SESSION* ses = my_session->branch_session;
my_session->branch_session = NULL; my_session->branch_session = NULL;
} }
} }
free(session);
return; return;
} }

View File

@ -680,6 +680,13 @@ int log_no_master = 1;
ptr->server->name, ptr->server->name,
ptr->server->port))); ptr->server->port)));
} }
/**
* Here we say: If the server's state changed
* so that it isn't running or some other way
* lost cluster membership, call call-back function
* of every DCB for which such callback was
* registered for this kind of issue (DCB_REASON_...)
*/
if (!(SERVER_IS_RUNNING(ptr->server)) || if (!(SERVER_IS_RUNNING(ptr->server)) ||
!(SERVER_IS_IN_CLUSTER(ptr->server))) !(SERVER_IS_IN_CLUSTER(ptr->server)))
{ {

View File

@ -1026,11 +1026,9 @@ static void freeSession(
ROUTER_CLIENT_SES* router_cli_ses; ROUTER_CLIENT_SES* router_cli_ses;
ROUTER_INSTANCE* router; ROUTER_INSTANCE* router;
int i; int i;
backend_ref_t* backend_ref;
router_cli_ses = (ROUTER_CLIENT_SES *)router_client_session; router_cli_ses = (ROUTER_CLIENT_SES *)router_client_session;
router = (ROUTER_INSTANCE *)router_instance; router = (ROUTER_INSTANCE *)router_instance;
backend_ref = router_cli_ses->rses_backend_ref;
spinlock_acquire(&router->lock); spinlock_acquire(&router->lock);
@ -3074,8 +3072,10 @@ static bool select_connect_backend_servers(
*/ */
execute_sescmd_history(&backend_ref[i]); execute_sescmd_history(&backend_ref[i]);
/** /**
* When server fails, this callback * Here we actually say : When this
* is called. * type of issue occurs (DCB_REASON_...)
* for this particular DCB,
* call this function.
*/ */
dcb_add_callback( dcb_add_callback(
backend_ref[i].bref_dcb, backend_ref[i].bref_dcb,