client: protect against possible NULL deref path

This commit is contained in:
Andy Green 2017-01-04 14:38:39 +08:00
parent 09d8720034
commit 249b2d049b

View file

@ -408,7 +408,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) {
context->protocols[0].callback(wsi,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,