From 4e41fc49f50a7a08f65dc23180e191da003c4b46 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Wed, 21 Aug 2013 12:08:41 +0200 Subject: [PATCH] Bug 166 - NULL pointer dereferenced if candidate server is NULL --- server/modules/routing/readwritesplit/readwritesplit.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 9b8a9cbba..b0ea41a00 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -264,6 +264,15 @@ static void* newSession( } } /* for */ + if (candidate == NULL) + { + + skygw_log_write_flush(LOGFILE_MESSAGE, + "No suitable servers found for connection."); + free(client); + return NULL; + } + if (inst->master == NULL) { inst->master = inst->servers[i-1]; }