]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't try to remove peers without IPs from peers_by_ip
authorTerry Wilson <twilson@digium.com>
Mon, 17 Oct 2011 15:35:05 +0000 (15:35 +0000)
committerTerry Wilson <twilson@digium.com>
Mon, 17 Oct 2011 15:35:05 +0000 (15:35 +0000)
(closes issue ASTERISK-18696)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@341088 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index c802877ffd35a713efd8d6fc6c37ec8181f35796..2d270d33e6d5e92f1f4da57af0786ca1bf5d4c5b 100644 (file)
@@ -26607,7 +26607,9 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                found++;
                /* we've unlinked the peer from the peers container but not unlinked from the peers_by_ip container yet
                  this leads to a wrong refcounter and the peer object is never destroyed */
-               ao2_t_unlink(peers_by_ip, peer, "ao2_unlink peer from peers_by_ip table");
+               if (!ast_sockaddr_isnull(&peer->addr)) {
+                       ao2_t_unlink(peers_by_ip, peer, "ao2_unlink peer from peers_by_ip table");
+               }
                if (!(peer->the_mark))
                        firstpass = 0;
        } else {