[asterisk-commits] res rtp asterisk.c: Fix off nominal memory leak. (asterisk[14])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 21 18:38:32 CST 2016


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4646 )

Change subject: res_rtp_asterisk.c: Fix off nominal memory leak.
......................................................................


res_rtp_asterisk.c: Fix off nominal memory leak.

Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75
---
M res/res_rtp_asterisk.c
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index afaa1f0..e15983e 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -1455,12 +1455,6 @@
 			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) {
@@ -1471,6 +1465,12 @@
 			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) ||

-- 
To view, visit https://gerrit.asterisk.org/4646
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list