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

Richard Mudgett asteriskteam at digium.com
Wed Jun 21 18:25:17 CDT 2017


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/5899


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/99/5899/1

diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c
index f73f10c..cc4b40a 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -1235,8 +1235,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);
@@ -1247,12 +1247,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/5899
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bc97c6608de1d1a4228826b3b3be43f162f05f3
Gerrit-Change-Number: 5899
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170621/327b0640/attachment.html>


More information about the asterisk-code-review mailing list