From 61df7eb07db472ccc29b1d26f76370e33fa637b3 Mon Sep 17 00:00:00 2001 From: Massimiliano Pinto Date: Wed, 4 Sep 2013 10:57:08 +0200 Subject: [PATCH] Added checks against NULL in gw_read_backend_event for dcb->session and dcb->session->client --- server/modules/protocol/mysql_backend.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/modules/protocol/mysql_backend.c b/server/modules/protocol/mysql_backend.c index 28ecfaf48..ce7d91b89 100644 --- a/server/modules/protocol/mysql_backend.c +++ b/server/modules/protocol/mysql_backend.c @@ -38,6 +38,8 @@ * 15/07/2013 Massimiliano Pinto Added Mysql session change via dcb->func.session() * 17/07/2013 Massimiliano Pinto Added dcb->command update from gwbuf->command for proper routing server replies to client via router->clientReply + * 04/09/2013 Massimiliano Pinto Added dcb->session and dcb->session->client checks for NULL + * in gw_read_backend_event() */ static char *version_str = "V2.0.0"; @@ -148,8 +150,15 @@ static int gw_read_backend_event(DCB *dcb) { if(dcb->session) { CHK_SESSION(dcb->session); + if (dcb->session->client == NULL) { + dcb->state = DCB_STATE_DISCONNECTED; + return 1; + } client_protocol = SESSION_PROTOCOL(dcb->session, MySQLProtocol); - } + } else { + dcb->state = DCB_STATE_DISCONNECTED; + return 1; + } backend_protocol = (MySQLProtocol *) dcb->protocol; /** return only with complete session */