From 986f2d8836372e16792bb7c22e1a7f0a87b3643f Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Mon, 12 Sep 2011 11:15:01 +0000 Subject: [PATCH] Merged revisions 335260 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/10 ................ r335260 | schmidts | 2011-09-12 11:11:45 +0000 (Mon, 12 Sep 2011) | 12 lines Merged revisions 335259 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r335259 | schmidts | 2011-09-12 11:09:19 +0000 (Mon, 12 Sep 2011) | 6 lines build_peer doesnt unlink a peer object from peers_by_ip container which leads to a wrong refcounter value. adding an ao2_unlink from the peers_by_ip container fix it. Review: https://reviewboard.asterisk.org/r/1428/ ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@335261 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 0300e41d97..2d71611895 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -27248,6 +27248,9 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str if (peer) { /* Already in the list, remove it and it will be added back (or FREE'd) */ 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 (!(peer->the_mark)) firstpass = 0; } else {