mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
vhost: fix allocated protocol list freeing at destroy time
This commit is contained in:
parent
80ff6ed0df
commit
7c6cfd2d05
3 changed files with 7 additions and 4 deletions
|
@ -114,7 +114,7 @@ lwsac_use(struct lwsac **head, size_t ensure, size_t chunk_size);
|
|||
*
|
||||
* Returns NULL if OOM.
|
||||
*/
|
||||
void *
|
||||
LWS_VISIBLE LWS_EXTERN void *
|
||||
lwsac_use_zeroed(struct lwsac **head, size_t ensure, size_t chunk_size);
|
||||
|
||||
/**
|
||||
|
|
|
@ -437,6 +437,7 @@ struct lws_vhost {
|
|||
int log_fd;
|
||||
#endif
|
||||
|
||||
unsigned int allocated_vhost_protocols:1;
|
||||
unsigned int created_vhost_protocols:1;
|
||||
unsigned int being_destroyed:1;
|
||||
|
||||
|
|
|
@ -583,9 +583,10 @@ lws_create_vhost(struct lws_context *context,
|
|||
#ifdef LWS_WITH_PLUGINS
|
||||
(context->plugin_list) ||
|
||||
#endif
|
||||
(context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS))
|
||||
(context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS)) {
|
||||
vh->protocols = lwsp;
|
||||
else {
|
||||
vh->allocated_vhost_protocols = 1;
|
||||
} else {
|
||||
vh->protocols = pcols;
|
||||
lws_free(lwsp);
|
||||
}
|
||||
|
@ -1047,7 +1048,8 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
|
|||
lws_free(vh->same_vh_protocol_heads);
|
||||
|
||||
if (context->plugin_list ||
|
||||
(context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS))
|
||||
(context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS) ||
|
||||
vh->allocated_vhost_protocols)
|
||||
lws_free((void *)vh->protocols);
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar)
|
||||
|
|
Loading…
Add table
Reference in a new issue