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

client-fix-header-stash-leak-on-close-before-success

This commit is contained in:
Andy Green 2017-07-21 21:49:24 +08:00
parent 003bd7dcee
commit 3562e441e3

View file

@ -326,6 +326,22 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
}
#endif
#if !defined(LWS_NO_CLIENT)
if (wsi->mode == LWSCM_HTTP_CLIENT ||
wsi->mode == LWSCM_WSCL_WAITING_CONNECT ||
wsi->mode == LWSCM_WSCL_WAITING_PROXY_REPLY ||
wsi->mode == LWSCM_WSCL_ISSUE_HANDSHAKE ||
wsi->mode == LWSCM_WSCL_ISSUE_HANDSHAKE2 ||
wsi->mode == LWSCM_WSCL_WAITING_SSL ||
wsi->mode == LWSCM_WSCL_WAITING_SERVER_REPLY ||
wsi->mode == LWSCM_WSCL_WAITING_EXTENSION_CONNECT ||
wsi->mode == LWSCM_WSCL_WAITING_SOCKS_GREETING_REPLY ||
wsi->mode == LWSCM_WSCL_WAITING_SOCKS_CONNECT_REPLY ||
wsi->mode == LWSCM_WSCL_WAITING_SOCKS_AUTH_REPLY)
if (wsi->u.hdr.stash)
lws_free_set_NULL(wsi->u.hdr.stash);
#endif
if (wsi->mode == LWSCM_RAW) {
wsi->protocol->callback(wsi,
LWS_CALLBACK_RAW_CLOSE, wsi->user_space, NULL, 0);