avoid using deallocated things during context dedtroy
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
6d5143548d
commit
88b9682e22
4 changed files with 13 additions and 2 deletions
|
@ -719,7 +719,7 @@ check_accept:
|
|||
|
||||
p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_ACCEPT);
|
||||
if (strcmp(p, wsi->u.hdr.ah->initial_handshake_hash_base64)) {
|
||||
lwsl_warn("lws_client_int_s_hs: accept %s wrong vs %s\n", p,
|
||||
lwsl_warn("lws_client_int_s_hs: accept '%s' wrong vs '%s'\n", p,
|
||||
wsi->u.hdr.ah->initial_handshake_hash_base64);
|
||||
goto bail2;
|
||||
}
|
||||
|
|
|
@ -299,6 +299,8 @@ libwebsocket_context_destroy(struct libwebsocket_context *context)
|
|||
if (!context)
|
||||
return;
|
||||
|
||||
context->being_destroyed = 1;
|
||||
|
||||
#ifdef LWS_LATENCY
|
||||
if (context->worst_latency_info[0])
|
||||
lwsl_notice("Worst latency: %s\n", context->worst_latency_info);
|
||||
|
|
|
@ -503,6 +503,8 @@ struct libwebsocket_context {
|
|||
#endif
|
||||
struct lws_token_limits *token_limits;
|
||||
void *user_space;
|
||||
|
||||
unsigned int being_destroyed:1;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -137,7 +137,14 @@ int lws_context_init_server(struct lws_context_creation_info *info,
|
|||
int
|
||||
_libwebsocket_rx_flow_control(struct libwebsocket *wsi)
|
||||
{
|
||||
struct libwebsocket_context *context = wsi->protocol->owning_server;
|
||||
struct libwebsocket_context *context;
|
||||
|
||||
if (!wsi)
|
||||
return 0;
|
||||
|
||||
context = wsi->protocol->owning_server;
|
||||
if (context->being_destroyed)
|
||||
return 0;
|
||||
|
||||
/* there is no pending change */
|
||||
if (!(wsi->rxflow_change_to & LWS_RXFLOW_PENDING_CHANGE))
|
||||
|
|
Loading…
Add table
Reference in a new issue