[asterisk-commits] rmudgett: trunk r399608 - in /trunk: ./ res/res_rtp_asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 20 23:49:28 CDT 2013


Author: rmudgett
Date: Fri Sep 20 23:49:26 2013
New Revision: 399608

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399608
Log:
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

Modified:
    trunk/   (props changed)
    trunk/res/res_rtp_asterisk.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Fri Sep 20 23:49:26 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531,399553,399565,399576,399583,399585,399596
+/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531,399553,399565,399576,399583,399585,399596,399607

Modified: trunk/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_rtp_asterisk.c?view=diff&rev=399608&r1=399607&r2=399608
==============================================================================
--- trunk/res/res_rtp_asterisk.c (original)
+++ trunk/res/res_rtp_asterisk.c Fri Sep 20 23:49:26 2013
@@ -3210,10 +3210,6 @@
 	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 @@
 	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 @@
 			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 */




More information about the asterisk-commits mailing list