[asterisk-dev] oej: trunk r128242 - /trunk/channels/chan_sip.c
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Sun Jul 6 08:22:07 CDT 2008
On Sunday 06 July 2008 03:02:21 Johansson Olle E wrote:
> 6 jul 2008 kl. 06.16 skrev Russell Bryant:
> > On Jul 5, 2008, at 4:59 PM, SVN commits to the Digium repositories
> >
> > wrote:
> >> Author: oej
> >> Date: Sat Jul 5 15:59:49 2008
> >> New Revision: 128242
> >>
> >> URL: http://svn.digium.com/view/asterisk?view=rev&rev=128242
> >> Log:
> >> KILL THE USER!
> >>
<snip>
> >> + if (sipmethod != SIP_SUBSCRIBE)
> >> + find_peer(NULL, &p->recv, TRUE, FALSE);
> >
> > There is a bug here. I'm not sure what the intent is, but this second
> > call to find_peer is clearly leaking a reference.
>
> Please help me with that, since I don't see the same. I'm not fully
> up to date with all the object changes in trunk, so I would be happy
> to learn from your or someone else's fix to this problem.
find_peer returns a reference to the peer found, if any. If you don't want
the reference, you'll need to capture the return value and deref it:
if (sipmethod != SIP_SUBSCRIBE) {
struct sip_peer *tmp = find_peer(NULL, &p->recv, TRUE, FALSE);
if (tmp) {
unref_peer(tmp);
}
}
--
Tilghman
More information about the asterisk-dev
mailing list