Fixed a possible memory leak when session command history limits are used.

This commit is contained in:
Markus Makela
2015-03-05 20:46:55 +02:00
parent 1299cf6ac9
commit c937568624
2 changed files with 5 additions and 1 deletions

View File

@ -290,6 +290,7 @@ struct router_client_session {
int rses_capabilities; /*< input type, for example */ int rses_capabilities; /*< input type, for example */
bool rses_autocommit_enabled; bool rses_autocommit_enabled;
bool rses_transaction_active; bool rses_transaction_active;
DCB* client_dcb;
#if defined(PREP_STMT_CACHING) #if defined(PREP_STMT_CACHING)
HASHTABLE* rses_prep_stmt[2]; HASHTABLE* rses_prep_stmt[2];
#endif #endif

View File

@ -790,6 +790,7 @@ static void* newSession(
#endif #endif
client_rses->router = router; client_rses->router = router;
client_rses->client_dcb = session->client;
/** /**
* If service config has been changed, reload config from service to * If service config has been changed, reload config from service to
* router instance first. * router instance first.
@ -4355,8 +4356,10 @@ static bool route_session_write(
LOGFILE_TRACE, LOGFILE_TRACE,
"Router session exceeded session command history limit. " "Router session exceeded session command history limit. "
"Closing router session. <"))); "Closing router session. <")));
router_cli_ses->rses_closed = true; gwbuf_free(querybuf);
rses_end_locked_router_action(router_cli_ses); rses_end_locked_router_action(router_cli_ses);
router_cli_ses->client_dcb->func.hangup(router_cli_ses->client_dcb);
goto return_succp; goto return_succp;
} }