8335b1
diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c
8335b1
index 19d3ec7..926e05e 100644
8335b1
--- a/modules/ssl/mod_ssl.c
8335b1
+++ b/modules/ssl/mod_ssl.c
8335b1
@@ -295,9 +295,12 @@ static apr_status_t ssl_cleanup_pre_config(void *data)
8335b1
 #endif
8335b1
     ERR_remove_state(0);
8335b1
 
8335b1
-    /* Don't call ERR_free_strings here; ERR_load_*_strings only
8335b1
-     * actually load the error strings once per process due to static
8335b1
+    /* Don't call ERR_free_strings in earlier versions, ERR_load_*_strings only
8335b1
+     * actually loaded the error strings once per process due to static
8335b1
      * variable abuse in OpenSSL. */
8335b1
+#if (OPENSSL_VERSION_NUMBER >= 0x00090805f)
8335b1
+    ERR_free_strings();
8335b1
+#endif
8335b1
 
8335b1
     /* Also don't call CRYPTO_cleanup_all_ex_data here; any registered
8335b1
      * ex_data indices may have been cached in static variables in
8335b1
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
8335b1
index 8425acb..508991e 100644
8335b1
--- a/modules/ssl/ssl_engine_init.c
8335b1
+++ b/modules/ssl/ssl_engine_init.c
8335b1
@@ -1065,7 +1065,7 @@ static void ssl_init_server_certs(server_rec *s,
8335b1
     const char *ecc_id;
8335b1
     EC_GROUP *ecparams;
8335b1
     int nid;
8335b1
-    EC_KEY *eckey;
8335b1
+    EC_KEY *eckey = NULL;
8335b1
 #endif
8335b1
     const char *vhost_id = mctx->sc->vhost_id;
8335b1
     int i;
8335b1
@@ -1151,10 +1151,11 @@ static void ssl_init_server_certs(server_rec *s,
8335b1
 #if defined(SSL_CTX_set_ecdh_auto)
8335b1
         SSL_CTX_set_ecdh_auto(mctx->ssl_ctx, 1);
8335b1
 #else
8335b1
-        SSL_CTX_set_tmp_ecdh(mctx->ssl_ctx,
8335b1
-                             EC_KEY_new_by_curve_name(NID_X9_62_prime256v1));
8335b1
+        eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
8335b1
+        SSL_CTX_set_tmp_ecdh(mctx->ssl_ctx, eckey);
8335b1
 #endif
8335b1
     }
8335b1
+    EC_KEY_free(eckey);
8335b1
 #endif
8335b1
 }
8335b1