[asterisk-dev] [Code Review] Fix possible memory leak with SIP realtime regs

wdoekes reviewboard at asterisk.org
Thu Sep 29 16:03:07 CDT 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1465/#review4456
-----------------------------------------------------------



/branches/1.8/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1465/#comment8604>

    this is still leaky if there is a sipregs entry without matching sippeers entry.
    
    simply moving this statement down a bit will help. no one is using the varregs yet.



/branches/1.8/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1465/#comment8605>

    once more. if we get sipregs entry but no sippeers entry, then we have a leak.



/branches/1.8/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1465/#comment8600>

    peerlist and var should be freed. 
    peerlist and varregs get freed => segfault on the latter (and a leak of 'var'.. but the segfault should prevent that ;) )
    
    (see my quick and dirty ast_variables_clone, it was there for a reason)


Enjoy ;)

P.S. I've been running r1395 on production (the 1.6 backport) for a week or two (with about 2k active accounts and ~40 accounts with insecure=*port), no complaints. But that obviously doesn't prove it will work for everyone.

- wdoekes


On Sept. 29, 2011, 12:53 p.m., Terry Wilson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1465/
> -----------------------------------------------------------
> 
> (Updated Sept. 29, 2011, 12:53 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> It was possible that if realtime sipregs are used, that the varregs variable returned by ast_load_realtime() would not be freed. This patch aims to correct that.
> 
> 
> This addresses bug ASTERISK-17792.
>     https://issues.asterisk.org/jira/browse/ASTERISK-17792
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_sip.c 338223 
> 
> Diff: https://reviewboard.asterisk.org/r/1465/diff
> 
> 
> Testing
> -------
> 
> It compiles. We return NULL in every case that ast_variables_destroy(varregs) is called, so there should be no chance of causing a problem with destroying the variable multiple times, etc.
> 
> 
> Thanks,
> 
> Terry
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110929/f0a9c821/attachment.htm>


More information about the asterisk-dev mailing list