]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_mwi.c: Eliminate RAII_VAR in contact delete observer
authorRichard Mudgett <rmudgett@digium.com>
Wed, 21 Jun 2017 22:57:11 +0000 (17:57 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 21 Jun 2017 23:21:57 +0000 (18:21 -0500)
Change-Id: I0bc97c6608de1d1a4228826b3b3be43f162f05f3

res/res_pjsip_mwi.c

index 513be8c3c4c16213775d17f6b7115f5f63aedcb8..05eee782e9f8f94e3e6d5e841d6b0ea4dca8530a 100644 (file)
@@ -1245,8 +1245,8 @@ static void mwi_contact_deleted(const void *object)
        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 @@ static void mwi_contact_deleted(const void *object)
        }
 
        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;
        }