summaryrefslogtreecommitdiff
path: root/main/rtp_engine.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-09-01 17:17:38 -0400
committerSean Bright <sean.bright@gmail.com>2017-09-01 18:00:03 -0500
commit60b44d1e38735d53dbfa4e346a9c3d8d8d925381 (patch)
treea5d725ff42f7f545d03b7f1cfc31a214e84fa3ec /main/rtp_engine.c
parent991750d3f1158628575fcdd88ce67da1368c18b2 (diff)
rtp_engine: Prevent possible double free with DTLS config
ASTERISK-27225 #close Reported by: Richard Kenner Change-Id: I097b81734ef730f8603c0b972909d212a3a5cf89
Diffstat (limited to 'main/rtp_engine.c')
-rw-r--r--main/rtp_engine.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index e078b2400..226b229f2 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -2718,35 +2718,35 @@ int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name,
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")) {