[Asterisk-code-review] res rtp asterisk.c: Fix off nominal memory leak. (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Wed Dec 21 11:14:52 CST 2016


Richard Mudgett has uploaded a new change for review. ( https://gerrit.asterisk.org/4645 )

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/45/4645/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 64b1372..1ae18fe 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/4645
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list