Commit 6c4d37ee authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Marko Mikulicic

Free previous ssl context in mg_set_ssl

    PUBLISHED_FROM=9f595222bce1fe8d0917649e36ce3be40eee1775
parent 97b79cd0
...@@ -2387,6 +2387,15 @@ const char *mg_set_ssl(struct mg_connection *nc, const char *cert, ...@@ -2387,6 +2387,15 @@ const char *mg_set_ssl(struct mg_connection *nc, const char *cert,
const char *result = NULL; const char *result = NULL;
DBG(("%p %s %s", nc, (cert ? cert : ""), (ca_cert ? ca_cert : ""))); 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) && if ((nc->flags & MG_F_LISTENING) &&
(nc->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) { (nc->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) {
result = "SSL_CTX_new() failed"; result = "SSL_CTX_new() failed";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment