From: Russell Bryant Date: Thu, 23 Aug 2007 17:02:50 +0000 (+0000) Subject: Fix some code where it was possible for a reference to a peer to not get X-Git-Tag: 1.4.12~202 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a44c1d55a2bc864458024dbc08e12bf420a0e88d;p=thirdparty%2Fasterisk.git Fix some code where it was possible for a reference to a peer to not get released when it should. Thank you to Marta Carbone for pointing this out! git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80499 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 546f14da10..214432400f 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5432,10 +5432,12 @@ static int authenticate_reply(struct chan_iax2_pvt *p, struct sockaddr_in *sin, /* No specified host, or this is our host */ ) { res = authenticate(p->challenge, peer->secret, peer->outkey, authmethods, &ied, sin, &p->ecx, &p->dcx); - peer_unref(peer); - if (!res) - break; + if (!res) { + peer_unref(peer); + break; + } } + peer_unref(peer); } if (!peer) { /* We checked our list and didn't find one. It's unlikely, but possible,