41a6c3
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
41a6c3
index ee46db4..c560422 100644
41a6c3
--- a/modules/ssl/ssl_engine_init.c
41a6c3
+++ b/modules/ssl/ssl_engine_init.c
41a6c3
@@ -915,7 +915,7 @@ static void ssl_init_server_certs(server_rec *s,
41a6c3
     const char *rsa_id, *dsa_id;
41a6c3
 #ifndef OPENSSL_NO_EC
41a6c3
     const char *ecc_id;
41a6c3
-    EC_GROUP *ecparams;
41a6c3
+    EC_GROUP *ecparams = NULL;
41a6c3
     int nid;
41a6c3
     EC_KEY *eckey = NULL;
41a6c3
 #endif
41a6c3
@@ -988,6 +988,7 @@ static void ssl_init_server_certs(server_rec *s,
41a6c3
                      "Custom DH parameters (%d bits) for %s loaded from %s",
41a6c3
                      BN_num_bits(dhparams->p), vhost_id,
41a6c3
                      mctx->pks->cert_files[0]);
41a6c3
+        DH_free(dhparams);
41a6c3
     }
41a6c3
 
41a6c3
 #ifndef OPENSSL_NO_EC
41a6c3
@@ -1012,6 +1013,9 @@ static void ssl_init_server_certs(server_rec *s,
41a6c3
         SSL_CTX_set_tmp_ecdh(mctx->ssl_ctx, eckey);
41a6c3
 #endif
41a6c3
     }
41a6c3
+    if (ecparams) {
41a6c3
+        EC_GROUP_free(ecparams);
41a6c3
+    }
41a6c3
     EC_KEY_free(eckey);
41a6c3
 #endif
41a6c3
 }