diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-12-07 15:23:02 -0600 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-12-21 11:15:23 -0600 |
commit | 8b7d252987ba066962b6c7707d1e00408bee3677 (patch) | |
tree | 32d1dbe2e2b5db3f888092c585af7bf0e4254b3a | |
parent | 500c6af9dbc049d4e608e322f45778072e6508ec (diff) |
res_rtp_asterisk.c: Fix off nominal memory leak.
Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75
-rw-r--r-- | res/res_rtp_asterisk.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 58c217ecb..b78fc30bd 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -1453,12 +1453,6 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con return -1; } - if (!(certbio = BIO_new(BIO_s_file()))) { - ast_log(LOG_ERROR, "Failed to allocate memory for certificate fingerprinting on RTP instance '%p'\n", - instance); - return -1; - } - if (rtp->local_hash == AST_RTP_DTLS_HASH_SHA1) { type = EVP_sha1(); } else if (rtp->local_hash == AST_RTP_DTLS_HASH_SHA256) { @@ -1469,6 +1463,12 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con return -1; } + if (!(certbio = BIO_new(BIO_s_file()))) { + ast_log(LOG_ERROR, "Failed to allocate memory for certificate fingerprinting on RTP instance '%p'\n", + instance); + return -1; + } + if (!BIO_read_filename(certbio, dtls_cfg->certfile) || !(cert = PEM_read_bio_X509(certbio, NULL, 0, NULL)) || !X509_digest(cert, type, fingerprint, &size) || |