mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
validity: fix bad pointer access
We cannot access wsi after __lws_close_free_wsi.
This commit is contained in:
parent
bfd921df9c
commit
6d8a798742
1 changed files with 4 additions and 3 deletions
|
@ -206,14 +206,15 @@ lws_validity_cb(lws_sorted_usec_list_t *sul)
|
|||
|
||||
if (wsi->validity_hup) {
|
||||
lwsl_wsi_info(wsi, "validity too old");
|
||||
struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
|
||||
struct lws_context *cx = wsi->a.context;
|
||||
struct lws_context_per_thread *pt = &cx->pt[(int)wsi->tsi];
|
||||
|
||||
lws_context_lock(wsi->a.context, __func__);
|
||||
lws_context_lock(cx, __func__);
|
||||
lws_pt_lock(pt, __func__);
|
||||
__lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
|
||||
"validity timeout");
|
||||
lws_pt_unlock(pt);
|
||||
lws_context_unlock(wsi->a.context);
|
||||
lws_context_unlock(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue