mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-23 00:00:06 +01:00
adoption: close socket manually if fails before add fds
This commit is contained in:
parent
fbc1ff6e7b
commit
3198446d3c
2 changed files with 7 additions and 1 deletions
|
@ -914,7 +914,9 @@ esp_err_t lws_esp32_event_passthru(void *ctx, system_event_t *event)
|
||||||
char slot[8];
|
char slot[8];
|
||||||
nvs_handle nvh;
|
nvs_handle nvh;
|
||||||
uint32_t use;
|
uint32_t use;
|
||||||
|
#if !defined(CONFIG_LWS_IS_FACTORY_APPLICATION)
|
||||||
int n;
|
int n;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch(event->event_id) {
|
switch(event->event_id) {
|
||||||
case SYSTEM_EVENT_STA_START:
|
case SYSTEM_EVENT_STA_START:
|
||||||
|
|
|
@ -1784,8 +1784,10 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
|
||||||
vh_prot_name, new_wsi->vhost->name);
|
vh_prot_name, new_wsi->vhost->name);
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
if (lws_ensure_user_space(new_wsi))
|
if (lws_ensure_user_space(new_wsi)) {
|
||||||
|
lwsl_notice("OOM trying to get user_space\n");
|
||||||
goto bail;
|
goto bail;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
if (type & LWS_ADOPT_HTTP) /* he will transition later */
|
if (type & LWS_ADOPT_HTTP) /* he will transition later */
|
||||||
new_wsi->protocol =
|
new_wsi->protocol =
|
||||||
|
@ -1889,11 +1891,13 @@ fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
|
lwsl_notice("%s: exiting on bail\n", __func__);
|
||||||
if (parent)
|
if (parent)
|
||||||
parent->child_list = new_wsi->sibling_list;
|
parent->child_list = new_wsi->sibling_list;
|
||||||
if (new_wsi->user_space)
|
if (new_wsi->user_space)
|
||||||
lws_free(new_wsi->user_space);
|
lws_free(new_wsi->user_space);
|
||||||
lws_free(new_wsi);
|
lws_free(new_wsi);
|
||||||
|
compatible_close(fd.sockfd);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue