[asterisk-commits] rtp engine: Prevent possible double free with DTLS config (asterisk[14])
    SVN commits to the Asterisk project 
    asterisk-commits at lists.digium.com
       
    Tue Sep  5 06:36:57 CDT 2017
    
    
  
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6381 )
Change subject: rtp_engine: Prevent possible double free with DTLS config
......................................................................
rtp_engine: Prevent possible double free with DTLS config
ASTERISK-27225 #close
Reported by: Richard Kenner
Change-Id: I097b81734ef730f8603c0b972909d212a3a5cf89
---
M main/rtp_engine.c
1 file changed, 4 insertions(+), 4 deletions(-)
Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 8d6c337..2f91b5a 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -2702,35 +2702,35 @@
 			return -1;
 		}
 	} else if (!strcasecmp(name, "dtlscertfile")) {
-		ast_free(dtls_cfg->certfile);
 		if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
 			ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
 			return -1;
 		}
+		ast_free(dtls_cfg->certfile);
 		dtls_cfg->certfile = ast_strdup(value);
 	} else if (!strcasecmp(name, "dtlsprivatekey")) {
-		ast_free(dtls_cfg->pvtfile);
 		if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
 			ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
 			return -1;
 		}
+		ast_free(dtls_cfg->pvtfile);
 		dtls_cfg->pvtfile = ast_strdup(value);
 	} else if (!strcasecmp(name, "dtlscipher")) {
 		ast_free(dtls_cfg->cipher);
 		dtls_cfg->cipher = ast_strdup(value);
 	} else if (!strcasecmp(name, "dtlscafile")) {
-		ast_free(dtls_cfg->cafile);
 		if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
 			ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
 			return -1;
 		}
+		ast_free(dtls_cfg->cafile);
 		dtls_cfg->cafile = ast_strdup(value);
 	} else if (!strcasecmp(name, "dtlscapath") || !strcasecmp(name, "dtlscadir")) {
-		ast_free(dtls_cfg->capath);
 		if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
 			ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
 			return -1;
 		}
+		ast_free(dtls_cfg->capath);
 		dtls_cfg->capath = ast_strdup(value);
 	} else if (!strcasecmp(name, "dtlssetup")) {
 		if (!strcasecmp(value, "active")) {
-- 
To view, visit https://gerrit.asterisk.org/6381
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: I097b81734ef730f8603c0b972909d212a3a5cf89
Gerrit-Change-Number: 6381
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170905/441cc6c8/attachment-0001.html>
    
    
More information about the asterisk-commits
mailing list