From 73ffa5a6487f45956e5f2048d01ab2a7886929b9 Mon Sep 17 00:00:00 2001 From: Massimiliano Pinto Date: Tue, 20 Aug 2013 11:37:57 +0200 Subject: [PATCH] dcb->data is allocated before poll_add_dcb in httpd_accept() This will prevent dcb->data to be NULL with threads --- server/modules/protocol/httpd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/modules/protocol/httpd.c b/server/modules/protocol/httpd.c index b428d72f0..0293f86cb 100644 --- a/server/modules/protocol/httpd.c +++ b/server/modules/protocol/httpd.c @@ -330,16 +330,16 @@ int n_connect = 0; client->state = DCB_STATE_IDLE; + /* create the session data for HTTPD */ + client_data = (HTTPD_session *)calloc(1, sizeof(HTTPD_session)); + client->data = client_data; + if (poll_add_dcb(client) == -1) { return n_connect; } n_connect++; - /* create the session data for HTTPD */ - client_data = (HTTPD_session *)calloc(1, sizeof(HTTPD_session)); - client->data = client_data; - client->state = DCB_STATE_POLLING; } }