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