From fff8daa898827e55a4b94e2019bf3f85df7e1ed2 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 2 Sep 2018 06:47:37 +0800 Subject: [PATCH] ws role: wsi ws may not have been allocated by time of close --- lib/roles/ws/ops-ws.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/roles/ws/ops-ws.c b/lib/roles/ws/ops-ws.c index 5336bf727..91d8c92da 100644 --- a/lib/roles/ws/ops-ws.c +++ b/lib/roles/ws/ops-ws.c @@ -1464,6 +1464,9 @@ rops_service_flag_pending_ws(struct lws_context *context, int tsi) static int rops_close_via_role_protocol_ws(struct lws *wsi, enum lws_close_status reason) { + if (!wsi->ws) + return 0; + if (!wsi->ws->close_in_ping_buffer_len && /* already a reason */ (reason == LWS_CLOSE_STATUS_NOSTATUS || reason == LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY))