[asterisk-commits] res pjsip mwi.c: Eliminate a simple RAII VAR. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 7 17:24:43 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: res_pjsip_mwi.c: Eliminate a simple RAII_VAR.
......................................................................


res_pjsip_mwi.c: Eliminate a simple RAII_VAR.

Change-Id: Ib1843f81e826a6c760c424c88eb70c350d9d61da
---
M res/res_pjsip_mwi.c
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c
index 701f6fb..4e73010 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -633,10 +633,10 @@
 static struct mwi_subscription *mwi_subscribe_single(
 	struct ast_sip_endpoint *endpoint, struct ast_sip_subscription *sip_sub, const char *name)
 {
-	RAII_VAR(struct ast_sip_aor *, aor,
-		 ast_sip_location_retrieve_aor(name), ao2_cleanup);
+	struct ast_sip_aor *aor;
 	struct mwi_subscription *sub;
 
+	aor = ast_sip_location_retrieve_aor(name);
 	if (!aor) {
 		/*! I suppose it's possible for the AOR to disappear on us
 		 * between accepting the subscription and sending the first
@@ -647,11 +647,12 @@
 		return NULL;
 	}
 
-	if (!(sub = mwi_create_subscription(endpoint, sip_sub))) {
-		return NULL;
+	sub = mwi_create_subscription(endpoint, sip_sub);
+	if (sub) {
+		mwi_on_aor(aor, sub, 0);
 	}
 
-	mwi_on_aor(aor, sub, 0);
+	ao2_ref(aor, -1);
 	return sub;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/799
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1843f81e826a6c760c424c88eb70c350d9d61da
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list