mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
vhost: remove from defer binding on destroy
If a vhost is removed, it should remove references to it from the defer binding list to avoid dangling pointers, which can crash the application.
This commit is contained in:
parent
599adff99d
commit
17bd1d0787
1 changed files with 14 additions and 0 deletions
|
@ -1354,6 +1354,20 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
|
|||
while (vh->timed_vh_protocol_list)
|
||||
__lws_timed_callback_remove(vh, vh->timed_vh_protocol_list);
|
||||
#endif
|
||||
/*
|
||||
* remove ourselves from the defer binding list
|
||||
*/
|
||||
lws_start_foreach_llp(struct lws_vhost **, pv,
|
||||
vh->context->no_listener_vhost_list) {
|
||||
if (*pv == vh) {
|
||||
lwsl_debug("deferred iface: removing vh %s\n",
|
||||
(*pv)->name);
|
||||
*pv = vh->no_listener_vhost_list;
|
||||
vh->no_listener_vhost_list = NULL;
|
||||
break;
|
||||
}
|
||||
} lws_end_foreach_llp(pv, no_listener_vhost_list);
|
||||
|
||||
/*
|
||||
* let the protocols destroy the per-vhost protocol objects
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue