ensure object reference is removed after unlinking from container
authorKevin P. Fleming <kpfleming@digium.com>
Sun, 1 May 2005 23:17:12 +0000 (23:17 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Sun, 1 May 2005 23:17:12 +0000 (23:17 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5545 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 809cc15..84c6b0b 100755 (executable)
@@ -4717,8 +4717,10 @@ static int expire_register(void *data)
        register_peer_exten(peer, 0);
        peer->expire = -1;
        ast_device_state_changed("SIP/%s", peer->name);
-       if (ast_test_flag(peer, SIP_SELFDESTRUCT) || ast_test_flag((&peer->flags_page2), SIP_PAGE2_RTAUTOCLEAR))
-               ASTOBJ_CONTAINER_UNLINK(&peerl, peer);
+       if (ast_test_flag(peer, SIP_SELFDESTRUCT) || ast_test_flag((&peer->flags_page2), SIP_PAGE2_RTAUTOCLEAR)) {
+               peer = ASTOBJ_CONTAINER_UNLINK(&peerl, peer);
+               ASTOBJ_UNREF(peer, sip_destroy_peer);
+       }
 
        return 0;
 }