[asterisk-commits] mmichelson: branch mmichelson/pub_sub r385822 - /team/mmichelson/pub_sub/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 15 16:58:07 CDT 2013


Author: mmichelson
Date: Mon Apr 15 16:58:05 2013
New Revision: 385822

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385822
Log:
One final round of comments and fixes.


Modified:
    team/mmichelson/pub_sub/res/res_sip_mwi.c

Modified: team/mmichelson/pub_sub/res/res_sip_mwi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip_mwi.c?view=diff&rev=385822&r1=385821&r2=385822
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip_mwi.c (original)
+++ team/mmichelson/pub_sub/res/res_sip_mwi.c Mon Apr 15 16:58:05 2013
@@ -118,6 +118,10 @@
 	struct mwi_stasis_subscription *mwi_stasis_sub;
 	struct stasis_topic *topic;
 	
+	if (!mwi_sub) {
+		return;
+	}
+	
 	mwi_stasis_sub = ao2_alloc(sizeof(*mwi_stasis_sub) + strlen(mailbox), NULL);
 	if (!mwi_stasis_sub) {
 		return NULL;
@@ -381,6 +385,10 @@
 		pjsip_rx_data *rdata)
 {
 	RAII_VAR(struct ast_sip_aor *, aor, NULL, ao2_cleanup);
+	/* It's not obvious here, but the reference(s) to this subscription,
+	 * once this function exits, is held by the stasis subscription(s)
+	 * created in mwi_stasis_subscription_alloc()
+	 */
 	RAII_VAR(struct mwi_subscription *, sub, NULL, ao2_cleanup);
 	pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
 	pjsip_sip_uri *sip_ruri;
@@ -543,7 +551,8 @@
 
 	mailboxes = ast_strdupa(endpoint->mailboxes);
 	while ((mailbox = strsep(&mailboxes, ","))) {
-		struct mwi_subscription *sub = aggregate_sub ?: mwi_subscription_alloc(endpoint, AST_SIP_SUBSCRIBER, 0, NULL);
+		struct mwi_subscription *sub = aggregate_sub ?:
+			mwi_subscription_alloc(endpoint, AST_SIP_SUBSCRIBER, 0, NULL);
 		RAII_VAR(struct mwi_stasis_subscription *, mwi_stasis_sub,
 				mwi_stasis_subscription_alloc(mailbox, sub), ao2_cleanup);
 		if (mwi_stasis_sub) {




More information about the asterisk-commits mailing list