[asterisk-dev] [Code Review]: Fix memory leak of SSL_CTX

Mark Michelson reviewboard at asterisk.org
Thu Apr 19 09:43:25 CDT 2012



> On April 18, 2012, 5:23 p.m., Matt Jordan wrote:
> > Assuming standard caveats that this actually fixes the memory leak in question, of course.

I have no doubt this is fixing *a* memory leak, but I don't have confirmation yet that it is going to clear up all leaks seen in issue ASTERISK-19278. I'm going to keep this review open until I get confirmation from the reporter that the bug is fixed. If there are further leaks, I'll add their fixes to this review, too.


> On April 18, 2012, 5:23 p.m., Matt Jordan wrote:
> > /branches/1.8/include/asterisk/tcptls.h, line 194
> > <https://reviewboard.asterisk.org/r/1875/diff/2/?file=27408#file27408line194>
> >
> >     Doxygen comment, with a \version tag stating when it was added (not that this is the most documented header file in existence, but still)

Yeah, I shouldn't follow the bad example given in the file. I'm not going to upload a new diff with just the documentation changes. I'll make those changes either when I commit this patch, or if I need to upload a new diff anyway because another memory leak needs to be fixed.


- Mark


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


On April 18, 2012, 2:45 p.m., Mark Michelson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1875/
> -----------------------------------------------------------
> 
> (Updated April 18, 2012, 2:45 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Based on information-gathering in issue ASTERISK-19278, it appears that Asterisk is misusing OpenSSL in a way that causes a slow memory leak. From combing through main/tcptls.c, it appears that one foul-up Asterisk has is to never free any SSL_CTXs that are created. I have patched __ssl_setup() to properly free the SSL_CTX if either
> 
> 1) We're about to allocate a new one.
> 2) Some failure occurs during setup.
> 
> While I have no confirmation that this is the same memory leak being observed in ASTERISK-19278, this fix seems necessary anyway. I'm placing this patch on Review Board because my unfamiliarity with OpenSSL leads me to seek confirmation that what I am doing makes sense and will not cause issues.
> 
> 
> This addresses bug ASTERISK-19278.
>     https://issues.asterisk.org/jira/browse/ASTERISK-19278
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_sip.c 362427 
>   /branches/1.8/include/asterisk/tcptls.h 362427 
>   /branches/1.8/main/tcptls.c 362427 
> 
> Diff: https://reviewboard.asterisk.org/r/1875/diff
> 
> 
> Testing
> -------
> 
> No testing has been done aside from compilation. I will ask the reporter on ASTERISK-19278 to test to see if the memory leak appears to go away.
> 
> 
> Thanks,
> 
> Mark
> 
>

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


More information about the asterisk-dev mailing list