Don't free wsi->u.hdr.ah except through lws_free_header_table (exception: server.c frees 'ah' after copying the header pointer and transitioning the union state).
This commit is contained in:
parent
377188189a
commit
a19d485b80
3 changed files with 5 additions and 12 deletions
|
@ -88,8 +88,7 @@ libwebsocket_close_and_free_session(struct libwebsocket_context *context,
|
|||
context->protocols[0].callback(context, wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR, wsi->user_space, NULL, 0);
|
||||
|
||||
free(wsi->u.hdr.ah);
|
||||
wsi->u.hdr.ah = NULL;
|
||||
lws_free_header_table(wsi);
|
||||
goto just_kill_connection;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,10 +268,7 @@ handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi)
|
|||
|
||||
bail:
|
||||
/* free up his parsing allocations */
|
||||
|
||||
if (wsi->u.hdr.ah)
|
||||
free(wsi->u.hdr.ah);
|
||||
|
||||
lws_free_header_table(wsi);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -550,9 +550,7 @@ upgrade_ws:
|
|||
}
|
||||
|
||||
/* drop the header info -- no bail_nuke_ah after this */
|
||||
|
||||
if (wsi->u.hdr.ah)
|
||||
free(wsi->u.hdr.ah);
|
||||
lws_free_header_table(wsi);
|
||||
|
||||
wsi->mode = LWS_CONNMODE_WS_SERVING;
|
||||
|
||||
|
@ -589,8 +587,7 @@ upgrade_ws:
|
|||
|
||||
bail_nuke_ah:
|
||||
/* drop the header info */
|
||||
if (wsi->u.hdr.ah)
|
||||
free(wsi->u.hdr.ah);
|
||||
lws_free_header_table(wsi);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -713,7 +710,7 @@ int lws_server_socket_service(struct libwebsocket_context *context,
|
|||
lwsl_info("lws_server_skt_srv: read 0 len\n");
|
||||
/* lwsl_info(" state=%d\n", wsi->state); */
|
||||
if (!wsi->hdr_parsing_completed)
|
||||
free(wsi->u.hdr.ah);
|
||||
lws_free_header_table(wsi);
|
||||
/* fallthru */
|
||||
case LWS_SSL_CAPABLE_ERROR:
|
||||
libwebsocket_close_and_free_session(
|
||||
|
|
Loading…
Add table
Reference in a new issue