summaryrefslogtreecommitdiff
path: root/res/res_rtp_asterisk.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-09-21 04:49:26 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-09-21 04:49:26 +0000
commitec5a72471465ec8a2661cea9d40184e6e9d1b33b (patch)
tree320fd341de6eda1d04222f792cfbfae2849abcd9 /res/res_rtp_asterisk.c
parent46da169b6dcb36bd35177d69f492aa0ae750070e (diff)
res_rtp_asterisk: Fix ref leaks in ast_rtcp_read().
Moved rtcp_report RAII_VAR declaration into the loop so it is unref'ed after every loop. Moved message_blob to loop and switched it to a regular variable. The regular variable was used since message_blob is used in a very contained way. (closes issue ASTERISK-22565) Reported by: Corey Farrell Patches: rtcp_report-leak.patch (license #5909) patch uploaded by Corey Farrell Tested by: Corey Farrell ........ Merged revisions 399607 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r--res/res_rtp_asterisk.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index edc53f56b..a5990c60f 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3210,10 +3210,6 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance)
int res, packetwords, position = 0;
int report_counter = 0;
struct ast_rtp_rtcp_report_block *report_block;
- RAII_VAR(struct ast_rtp_rtcp_report *, rtcp_report,
- NULL,
- ao2_cleanup);
- RAII_VAR(struct ast_json *, message_blob, NULL, ast_json_unref);
struct ast_frame *f = &ast_null_frame;
/* Read in RTCP data from the socket */
@@ -3274,6 +3270,8 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance)
while (position < packetwords) {
int i, pt, rc;
unsigned int length;
+ struct ast_json *message_blob;
+ RAII_VAR(struct ast_rtp_rtcp_report *, rtcp_report, NULL, ao2_cleanup);
i = position;
length = ntohl(rtcpheader[i]);
@@ -3397,6 +3395,7 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance)
ast_rtp_publish_rtcp_message(instance, ast_rtp_rtcp_received_type(),
rtcp_report,
message_blob);
+ ast_json_unref(message_blob);
break;
case RTCP_PT_FUR:
/* Handle RTCP FIR as FUR */