[asterisk-dev] oej: trunk r128242 - /trunk/channels/chan_sip.c

Russell Bryant russell at digium.com
Sat Jul 5 23:16:50 CDT 2008


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!
>
> Actually, kill the in-memory structure for type=user and start using  
> the sip_peer
> structure for every object. Have only one in-memory list and use  
> them different
> ways depending on type=user, type=peer and type=friend - like always.
>
> The idea with this first patch is that configurations should work as  
> before.
>
> Some additional features for realtime peers. By adding a type=  
> field, you
> can now have multiple functions.
>
> Let's test this for a while. Won't be integrated in 1.6.0, only in  
> trunk,
> for testing.
>
> There's propably more to clean up and simplify here. Help is welcome
> and encouraged!

First comment; please update sip.conf.sample to reflect these changes.

> @@ -11931,10 +11649,15 @@
> 	int debug=sip_debug_test_addr(sin);
> 	struct sip_peer *peer;
>
> -	/* For subscribes, match on peer name only; for other methods,
> +	/* For subscribes, match on device name only; for other methods,
> 	 * match on IP address-port of the incoming request.
> 	 */
> -	peer = (sipmethod == SIP_SUBSCRIBE) ? find_peer(of, NULL, 1) :  
> find_peer(NULL, &p->recv, 1);
> +	/* First find device on name */
> +	peer = find_peer(of, NULL, TRUE, FALSE);
> +
> +	/* Then find device on IP (if it's not a SUBSCRIBE) */
> +	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.

--
Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.







More information about the asterisk-dev mailing list