From 0c07ddb5ad021323b348b7eb271ab4d86f128bdd Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 31 Jan 2015 14:12:06 +1100 Subject: [PATCH] Don't use client structure out of lock in connector's drop_client --- src/connector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/connector.c b/src/connector.c index f1679362..750fa90e 100644 --- a/src/connector.c +++ b/src/connector.c @@ -212,11 +212,13 @@ static int accept_client(cdata_t *cdata, const int epfd, const uint64_t server) /* Client must hold a reference count */ static int drop_client(cdata_t *cdata, client_instance_t *client) { + int64_t client_id = 0; int fd; ck_wlock(&cdata->lock); fd = client->fd; if (fd != -1) { + client_id = client->id; Close(client->fd); HASH_DEL(cdata->clients, client); DL_APPEND(cdata->dead_clients, client); @@ -228,7 +230,7 @@ static int drop_client(cdata_t *cdata, client_instance_t *client) ck_wunlock(&cdata->lock); if (fd > -1) - LOGINFO("Connector dropped client %"PRId64" fd %d", client->id, fd); + LOGINFO("Connector dropped client %"PRId64" fd %d", client_id, fd); return fd; }