summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-08-05 12:45:09 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-08-05 12:45:09 -0500
commit56d11d41988908f3ae1dc5fd9c1fd5bf3ab8ef7e (patch)
tree434578456b4b1a680ad1687768e559dd6decb2c9
parent27dc2094e98b59b8a50b059ddd6048285a42e6b9 (diff)
parent9a12804e592b97d74ff7b909e0d0022f1ca72386 (diff)
Merge "res_rtp_asterisk: Don't leak temporary key when enabling PFS." into 13
-rw-r--r--res/res_rtp_asterisk.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 0c47e1e25..462091778 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -1268,6 +1268,9 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
int res;
+#ifndef HAVE_OPENSSL_ECDH_AUTO
+ EC_KEY *ecdh;
+#endif
if (!dtls_cfg->enabled) {
return 0;
@@ -1291,8 +1294,11 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con
#ifdef HAVE_OPENSSL_ECDH_AUTO
SSL_CTX_set_ecdh_auto(rtp->ssl_ctx, 1);
#else
- SSL_CTX_set_tmp_ecdh(rtp->ssl_ctx,
- EC_KEY_new_by_curve_name(NID_X9_62_prime256v1));
+ ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
+ if (ecdh) {
+ SSL_CTX_set_tmp_ecdh(rtp->ssl_ctx, ecdh);
+ EC_KEY_free(ecdh);
+ }
#endif
rtp->dtls_verify = dtls_cfg->verify;