Changes to try to eliminate setting dcb->session to NULL with risk of crashing system.

This commit is contained in:
counterpoint
2015-08-24 12:12:43 +01:00
parent 5e2e2585ad
commit 37ac158791
7 changed files with 182 additions and 194 deletions

View File

@ -351,7 +351,8 @@ int n_connect = 0;
memcpy(&client->func, &MyObject, sizeof(GWPROTOCOL));
/* we don't need the session */
client->session = NULL;
/* But not clear that we have one! */
/* client->session = NULL; */
/* create the session data for HTTPD */
client_data = (HTTPD_session *)calloc(1, sizeof(HTTPD_session));
@ -360,9 +361,10 @@ int n_connect = 0;
client->session =
session_alloc(dcb->session->service, client);
if (poll_add_dcb(client) == -1)
if (NULL == client->session || poll_add_dcb(client) == -1)
{
close(so);
dcb_close(client);
return n_connect;
}
n_connect++;