[asterisk-dev] [Code Review]: Fix possible memory leak with SIP realtime regs
wdoekes
reviewboard at asterisk.org
Fri Sep 30 01:34:52 CDT 2011
> On Sept. 29, 2011, 4:03 p.m., wdoekes wrote:
> > /branches/1.8/channels/chan_sip.c, lines 4665-4666
> > <https://reviewboard.asterisk.org/r/1465/diff/2/?file=20922#file20922line4665>
> >
> > 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.
>
> Terry Wilson wrote:
> Every single return in the function is preceeded by an ast_variables_destroy(varregs). I don't see how this could still leak. Am I missing something?
Unfortunately, you are. Even though every return is preceeded by a destroy, every (re)assignment of varregs isn't. Alloc (ast_load_realtime) twice, free once => leak.
- wdoekes
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1465/#review4456
-----------------------------------------------------------
On Sept. 29, 2011, 5:30 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, 5:30 p.m.)
>
>
> Review request for Asterisk Developers and wdoekes.
>
>
> 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/20110930/d2c698de/attachment.htm>
More information about the asterisk-dev
mailing list