diff --git a/server/modules/routing/readconnroute.c b/server/modules/routing/readconnroute.c index 6128f97e3..7cf50d8f5 100644 --- a/server/modules/routing/readconnroute.c +++ b/server/modules/routing/readconnroute.c @@ -56,8 +56,9 @@ * with macros and MySQL commands with MYSQL_ prefix * avoiding any conflict with the standard ones * in mysql.h - * 22/07/13 Mark Riddoch Addition of joined router option for Galera + * 22/07/2013 Mark Riddoch Addition of joined router option for Galera * clusters + * 31/07/2013 Massimiliano Pinto Added a check for candidate server, if NULL return * * @endverbatim */ @@ -296,6 +297,12 @@ int i; } } + /* no candidate server here, clean and return NULL */ + if (!candidate) { + free(client); + return NULL; + } + /* * We now have the server with the least connections. * Bump the connection count for this server