Place checks in callback routines because DCB will not always contain a reference to a router session, and the associated data will be invalid in this case.

This commit is contained in:
counterpoint
2015-09-25 12:17:11 +01:00
parent 2dfb9e3c11
commit 2231d0870c
5 changed files with 39 additions and 5 deletions

View File

@ -71,6 +71,7 @@ extern __thread log_info_t tls_log_info;
* 17/07/2014 Massimiliano Pinto Server connection counter is updated in closeSession
*
* 09/09/2015 Martin Brampton Modify error handler
* 25/09/2015 Martin Brampton Block callback processing when no router session in the DCB
*
* @endverbatim
*/
@ -5308,6 +5309,15 @@ static int router_handle_state_switch(
int rc = 1;
SERVER* srv;
CHK_DCB(dcb);
if (NULL == dcb->session->router_session)
{
/*
* The following processing will fail if there is no router session,
* because the "data" parameter will not contain meaningful data,
* so we have no choice but to stop here.
*/
return;
}
bref = (backend_ref_t *)data;
CHK_BACKEND_REF(bref);