[asterisk-dev] [Code Review] Resolve memory leaks in TLS

Matt Jordan reviewboard at asterisk.org
Tue Sep 11 14:22:52 CDT 2012


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

Review request for Asterisk Developers.


Summary
-------

Due to the tireless efforts of Thomas Arimont, two sources memory leaks in TLS have been discovered.  These are:

* Improper initialization (and multiple re-initializations) of portions of the SSL library.  You should only need to call SSL_library_init() and SSL_load_error_strings() once; OpenSSL_add_all_algorithms is already accounted for by SSL_library_init, and SSL_load_crypto_strings is already accounted for by SSL_load_error_strings.  This action was happening multiple times as well when setting up an SSL session.
* Failure to completely clean up after a TLS client.  This included not clearing the error stack when the TLS client thread exited, and not disposing of the SSL_CTX object when the TLS client was finished.

This patch resolves both memory leaks, and removes some sleep(2) calls in off nominal paths.


This addresses bug AST-889.
    https://issues.asterisk.org/jira/browse/AST-889


Diffs
-----

  /branches/1.8/channels/chan_sip.c 372882 
  /branches/1.8/main/ssl.c 372882 
  /branches/1.8/main/tcptls.c 372882 

Diff: https://reviewboard.asterisk.org/r/2105/diff


Testing
-------

Tested by Thomas Arimont extensively.


Thanks,

Matt

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


More information about the asterisk-dev mailing list