[Asterisk-code-review] res pjsip mwi.c: Eliminate RAII VAR in contact delete observer (asterisk[13])

Joshua Colp asteriskteam at digium.com
Thu Jun 22 15:55:01 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5897 )

Change subject: res_pjsip_mwi.c: Eliminate RAII_VAR in contact delete observer
......................................................................

res_pjsip_mwi.c: Eliminate RAII_VAR in contact delete observer

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

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c
index 513be8c..05eee78 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -1245,8 +1245,8 @@
 	const struct ast_sip_contact *contact = object;
 	struct ao2_iterator *mwi_subs;
 	struct mwi_subscription *mwi_sub;
-	RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_sip_contact *, found_contact, NULL, ao2_cleanup);
+	struct ast_sip_endpoint *endpoint = NULL;
+	struct ast_sip_contact *found_contact;
 
 	if (contact->endpoint) {
 		endpoint = ao2_bump(contact->endpoint);
@@ -1257,12 +1257,15 @@
 	}
 
 	if (!endpoint || ast_strlen_zero(endpoint->subscription.mwi.mailboxes)) {
+		ao2_cleanup(endpoint);
 		return;
 	}
 
 	/* Check if there is another contact */
 	found_contact = ast_sip_location_retrieve_contact_from_aor_list(endpoint->aors);
+	ao2_cleanup(endpoint);
 	if (found_contact) {
+		ao2_cleanup(found_contact);
 		return;
 	}
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I0bc97c6608de1d1a4228826b3b3be43f162f05f3
Gerrit-Change-Number: 5897
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170622/d77ae1c4/attachment.html>


More information about the asterisk-code-review mailing list