From ec39117a1c7d7bf2467c91a53053ade6b9b5ddcb Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 26 Apr 2015 20:17:55 +1000 Subject: [PATCH] Don't return client if it is invalid in ref_client_by_id in the connector --- src/connector.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/connector.c b/src/connector.c index a94ee304..e748808e 100644 --- a/src/connector.c +++ b/src/connector.c @@ -435,8 +435,12 @@ static client_instance_t *ref_client_by_id(cdata_t *cdata, int64_t id) ck_wlock(&cdata->lock); HASH_FIND_I64(cdata->clients, &id, client); - if (client && !client->invalid) - __inc_instance_ref(client); + if (client) { + if (!client->invalid) + __inc_instance_ref(client); + else + client = NULL; + } ck_wunlock(&cdata->lock); return client;