]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
endpoint snapshot: avoid second cleanup on alloc failure 84/1184/1
authorScott Griepentrog <scott@griepentrog.com>
Fri, 4 Sep 2015 14:26:46 +0000 (09:26 -0500)
committerScott Griepentrog <sgriepentrog@digium.com>
Fri, 4 Sep 2015 14:33:33 +0000 (09:33 -0500)
In ast_endpoint_snapshot_create(), a failure to init the
string fields results in two attempts to ao2_cleanup the
same pointer.  Removed RAII_VAR to eliminate problem.

ASTERISK-25375 #close
Reported by: Scott Griepentrog

Change-Id: If4d9dfb1bbe3836b623642ec690b6d49b25e8979

main/endpoints.c

index ce0ab0292a158745c8a7aee99a90b81e1c8dabd1..0155adfebdcb8cbf2378d18c897e1747952801b0 100644 (file)
@@ -464,7 +464,7 @@ static void endpoint_snapshot_dtor(void *obj)
 struct ast_endpoint_snapshot *ast_endpoint_snapshot_create(
        struct ast_endpoint *endpoint)
 {
-       RAII_VAR(struct ast_endpoint_snapshot *, snapshot, NULL, ao2_cleanup);
+       struct ast_endpoint_snapshot *snapshot;
        int channel_count;
        struct ao2_iterator i;
        void *obj;
@@ -500,7 +500,6 @@ struct ast_endpoint_snapshot *ast_endpoint_snapshot_create(
        }
        ao2_iterator_destroy(&i);
 
-       ao2_ref(snapshot, +1);
        return snapshot;
 }