client: protect against possible NULL deref path

This commit is contained in:
Andy Green 2017-01-04 14:38:05 +08:00
parent 10eacf2873
commit eefcaa762e

View file

@ -499,7 +499,9 @@ just_kill_connection:
char* errorString;
lwsl_debug("Connection closed before server reply\n");
errorString = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
errorString = NULL;
if (wsi->u.hdr.ah)
errorString = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
if (errorString) {
wsi->vhost->protocols[0].callback(wsi,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,