summaryrefslogtreecommitdiff
path: root/main/rtp_engine.c
diff options
context:
space:
mode:
authorSteve Davies <steve@one47.co.uk>2015-04-28 11:38:30 +0100
committerJoshua Colp <jcolp@digium.com>2015-04-28 06:57:39 -0500
commit0b6410c4f880d8f715621de2c95b07ea3489d853 (patch)
treec04e6dee60e4d7682e698c8c9468834f79e62a2d /main/rtp_engine.c
parent427209603d77a3e26925cda5725294fe5a7026b0 (diff)
res_rtp_asterisk: Resolve 2 discrete memory leaks in DTLS
ao2 ref leak in res_rtp_asterisk.c when a DTLS policy is created. The resources are linked into a table, but the original alloc refs are never released. ast_strdup leak in rtp_engine.c. If ast_rtp_dtls_cfg_copy() is called twice on the same destination struct, a pointer to an alloc'd string is overwritten before the string is free'd. ASTERISK-25022 Reported by: one47 Change-Id: I62a8ceb8679709f6c3769136dc6aa9a68202ff9b
Diffstat (limited to 'main/rtp_engine.c')
-rw-r--r--main/rtp_engine.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 444c995ed..8d6977d88 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -1659,6 +1659,8 @@ int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name,
void ast_rtp_dtls_cfg_copy(const struct ast_rtp_dtls_cfg *src_cfg, struct ast_rtp_dtls_cfg *dst_cfg)
{
+ ast_rtp_dtls_cfg_free(dst_cfg); /* Prevent a double-call leaking memory via ast_strdup */
+
dst_cfg->enabled = src_cfg->enabled;
dst_cfg->verify = src_cfg->verify;
dst_cfg->rekey = src_cfg->rekey;