mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +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
ac17bde9d9
commit
162e11e530
1 changed files with 14 additions and 0 deletions
|
@ -1456,6 +1456,20 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
|
||||||
|
|
||||||
// lwsl_info("%s: %s\n", __func__, vh->name);
|
// lwsl_info("%s: %s\n", __func__, vh->name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
* let the protocols destroy the per-vhost protocol objects
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue