1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

ss: protect against reentry in lws_destroy

This commit is contained in:
Jed Lu 2020-08-26 14:03:57 +01:00 committed by Andy Green
parent c54a35e1a9
commit 3b9e468516
2 changed files with 7 additions and 0 deletions

View file

@ -153,6 +153,7 @@ typedef struct lws_ss_handle {
uint8_t hanging_som:1;
uint8_t inside_msg:1;
uint8_t being_serialized:1; /* we are not the consumer */
uint8_t destroying:1;
} lws_ss_handle_t;
/* connection helper that doesn't need to hang around after connection starts */

View file

@ -808,6 +808,12 @@ lws_ss_destroy(lws_ss_handle_t **ppss)
if (!h)
return;
if (h->destroying) {
lwsl_info("%s: reentrant destroy\n", __func__);
return;
}
h->destroying = 1;
if (h->wsi) {
/*
* Don't let the wsi point to us any more,