[asterisk-commits] file: branch group/pimp_my_sip r389890 - /team/group/pimp_my_sip/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 28 12:12:47 CDT 2013


Author: file
Date: Tue May 28 12:12:44 2013
New Revision: 389890

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389890
Log:
Fix some session reference counting with pushed tasks.

Modified:
    team/group/pimp_my_sip/channels/chan_gulp.c

Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=389890&r1=389889&r2=389890
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Tue May 28 12:12:44 2013
@@ -510,7 +510,11 @@
 
 	if (changed) {
 		ao2_ref(session, +1);
-		ast_sip_push_task(session->serializer, send_direct_media_request, session);
+
+
+		if (ast_sip_push_task(session->serializer, send_direct_media_request, session)) {
+			ao2_cleanup(session);
+		}
 	}
 
 	return 0;
@@ -827,7 +831,7 @@
 		.body_text = xml
 	};
 
-	struct ast_sip_session *session = data;
+	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
 	struct pjsip_tx_data *tdata;
 
 	if (ast_sip_create_request("INFO", session->inv_session->dlg, session->endpoint, NULL, &tdata)) {
@@ -903,9 +907,14 @@
 	case AST_CONTROL_VIDUPDATE:
 		media = pvt->media[SIP_MEDIA_VIDEO];
 		if (media && media->rtp) {
-			ast_sip_push_task(session->serializer, transmit_info_with_vidupdate, session);
-		} else
+			ao2_ref(session, +1);
+
+			if (ast_sip_push_task(session->serializer, transmit_info_with_vidupdate, session)) {
+				ao2_cleanup(session);
+			}
+		} else {
 			res = -1;
+		}
 		break;
 	case AST_CONTROL_UPDATE_RTP_PEER:
 	case AST_CONTROL_PVT_CAUSE_CODE:




More information about the asterisk-commits mailing list