httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1781188 - in /httpd/httpd/trunk/modules/ssl: ssl_engine_config.c ssl_engine_init.c
Date Tue, 31 Jan 2017 23:39:58 GMT
Author: ylavic
Date: Tue Jan 31 23:39:58 2017
New Revision: 1781188

URL: http://svn.apache.org/viewvc?rev=1781188&view=rev
Log:
mod_ssl: follow up to r1740928: fix memory leaks.


Modified:
    httpd/httpd/trunk/modules/ssl/ssl_engine_config.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_init.c

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_config.c?rev=1781188&r1=1781187&r2=1781188&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_config.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_config.c Tue Jan 31 23:39:58 2017
@@ -98,6 +98,12 @@ BOOL ssl_config_global_isfixed(SSLModCon
 **  _________________________________________________________________
 */
 
+static apr_status_t modssl_ctx_config_cleanup(void *ctx)
+{
+    SSL_CONF_CTX_free(ctx);
+    return APR_SUCCESS;
+}
+
 static void modssl_ctx_init(modssl_ctx_t *mctx, apr_pool_t *p)
 {
     mctx->sc                  = NULL; /* set during module init */
@@ -157,6 +163,9 @@ static void modssl_ctx_init(modssl_ctx_t
 #endif
 #ifdef HAVE_SSL_CONF_CMD
     mctx->ssl_ctx_config = SSL_CONF_CTX_new();
+    apr_pool_cleanup_register(p, mctx->ssl_ctx_config,
+                              modssl_ctx_config_cleanup,
+                              apr_pool_cleanup_null);
     SSL_CONF_CTX_set_flags(mctx->ssl_ctx_config, SSL_CONF_FLAG_FILE);
     SSL_CONF_CTX_set_flags(mctx->ssl_ctx_config, SSL_CONF_FLAG_SERVER);
     SSL_CONF_CTX_set_flags(mctx->ssl_ctx_config, SSL_CONF_FLAG_CERTIFICATE);

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_init.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_init.c?rev=1781188&r1=1781187&r2=1781188&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_init.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_init.c Tue Jan 31 23:39:58 2017
@@ -1617,6 +1617,11 @@ static apr_status_t ssl_init_proxy_ctx(s
 {
     apr_status_t rv;
 
+    if (proxy->ssl_ctx) {
+        /* Merged/initialized already */
+        return APR_SUCCESS;
+    }
+
     apr_pool_cleanup_register(p, proxy,
                               ssl_cleanup_proxy_ctx,
                               apr_pool_cleanup_null);
@@ -1687,7 +1692,6 @@ static apr_status_t ssl_init_server_ctx(
             ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
             return ssl_die(s);
     }
-    SSL_CONF_CTX_free(cctx);
 #endif
 
     if (SSL_CTX_check_private_key(sc->server->ssl_ctx) != 1) {



Mime
View raw message