From 0227c4afffb731c271ddf1f5c8e0ae8fee230dc7 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Tue, 25 Jun 2013 10:38:24 +0200 Subject: [PATCH] Added error return in readroute when backend connection fails --- modules/routing/readconnroute.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/routing/readconnroute.c b/modules/routing/readconnroute.c index acf9e1ef9..a7b4a45ab 100644 --- a/modules/routing/readconnroute.c +++ b/modules/routing/readconnroute.c @@ -210,7 +210,13 @@ int i; * connection in the client->dcb */ - client->dcb = dcb_connect(candidate->server, session, candidate->server->protocol); + if ((client->dcb = dcb_connect(candidate->server, session, + candidate->server->protocol)) == NULL) + { + atomic_add(&candidate->count, -1); + free(client); + return NULL; + } /* Add this session to the list of active sessions */ spinlock_acquire(&inst->lock);