mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-21 01:13:43 +08:00
Free previous ssl context in mg_set_ssl
PUBLISHED_FROM=9f595222bce1fe8d0917649e36ce3be40eee1775
This commit is contained in:
parent
97b79cd04a
commit
6c4d37ee68
@ -2387,6 +2387,15 @@ const char *mg_set_ssl(struct mg_connection *nc, const char *cert,
|
||||
const char *result = NULL;
|
||||
DBG(("%p %s %s", nc, (cert ? cert : ""), (ca_cert ? ca_cert : "")));
|
||||
|
||||
if (nc->ssl != NULL) {
|
||||
SSL_free(nc->ssl);
|
||||
nc->ssl = NULL;
|
||||
}
|
||||
if (nc->ssl_ctx != NULL) {
|
||||
SSL_CTX_free(nc->ssl_ctx);
|
||||
nc->ssl_ctx = NULL;
|
||||
}
|
||||
|
||||
if ((nc->flags & MG_F_LISTENING) &&
|
||||
(nc->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) {
|
||||
result = "SSL_CTX_new() failed";
|
||||
|
Loading…
Reference in New Issue
Block a user