mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Bugfix: SSL code should not free wsi
The SSL code should not do lws_free(new_wsi) here. The caller should clean up the wsi in libwebsocket_close_and_free_session. Instead this can potentially cause a crash during that call. Also if we fail to create the SSL for hte listener we should indicate failure to the caller.
This commit is contained in:
parent
12f557b21d
commit
8361d34ff9
1 changed files with 5 additions and 5 deletions
10
lib/ssl.c
10
lib/ssl.c
|
@ -535,12 +535,12 @@ lws_server_socket_service_ssl(struct libwebsocket_context *context,
|
|||
new_wsi->ssl = SSL_new(context->ssl_ctx);
|
||||
if (new_wsi->ssl == NULL) {
|
||||
lwsl_err("SSL_new failed: %s\n",
|
||||
ERR_error_string(SSL_get_error(
|
||||
new_wsi->ssl, 0), NULL));
|
||||
libwebsockets_decode_ssl_error();
|
||||
lws_free(new_wsi);
|
||||
ERR_error_string(SSL_get_error(new_wsi->ssl, 0), NULL));
|
||||
libwebsockets_decode_ssl_error();
|
||||
|
||||
// TODO: Shouldn't the caller handle this?
|
||||
compatible_close(accept_fd);
|
||||
break;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
SSL_set_ex_data(new_wsi->ssl,
|
||||
|
|
Loading…
Add table
Reference in a new issue