]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
stasis: Remove silly use of RAII_VAR in stasis_forward_all.
authorCorey Farrell <git@cfware.com>
Mon, 6 Nov 2017 20:23:46 +0000 (15:23 -0500)
committerCorey Farrell <git@cfware.com>
Mon, 6 Nov 2017 20:24:57 +0000 (15:24 -0500)
Change-Id: I46de4c968d40144d5b049966304ff66c1469fb65

main/stasis.c

index 48e4eb5a554d17bce57b9a2b2318a7c6b8d6fcd9..372e9191dccc2d4af529365b977fa89b3ed2ea2b 100644 (file)
@@ -910,7 +910,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
 {
        int res;
        size_t idx;
-       RAII_VAR(struct stasis_forward *, forward, NULL, ao2_cleanup);
+       struct stasis_forward *forward;
 
        if (!from_topic || !to_topic) {
                return NULL;
@@ -923,7 +923,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
 
        /* Forwards to ourselves are implicit. */
        if (to_topic == from_topic) {
-               return ao2_bump(forward);
+               return forward;
        }
 
        forward->from_topic = ao2_bump(from_topic);
@@ -934,6 +934,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
        if (res != 0) {
                ao2_unlock(from_topic);
                ao2_unlock(to_topic);
+               ao2_ref(forward, -1);
                return NULL;
        }
 
@@ -943,7 +944,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
        ao2_unlock(from_topic);
        ao2_unlock(to_topic);
 
-       return ao2_bump(forward);
+       return forward;
 }
 
 static void subscription_change_dtor(void *obj)