]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_mwi.c: Eliminate a simple RAII_VAR. 96/796/1
authorRichard Mudgett <rmudgett@digium.com>
Tue, 30 Jun 2015 16:14:57 +0000 (11:14 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 6 Jul 2015 20:59:52 +0000 (15:59 -0500)
Change-Id: Ib1843f81e826a6c760c424c88eb70c350d9d61da

res/res_pjsip_mwi.c

index 1ed39f5a683adb4252440013535f6b5e0ae17b65..17b07e11c4a6323635276859718c9ba4a5a3802d 100644 (file)
@@ -633,10 +633,10 @@ static struct mwi_subscription *mwi_create_subscription(
 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 @@ static struct mwi_subscription *mwi_subscribe_single(
                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;
 }