Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(598)

Issue 2326: Memory leak in SSL connections, CTX_free needed (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 11 months ago by Jacob
Modified:
15 years, 9 months ago
Reviewers:
dangabrad, djabberd
Base URL:
http://code.sixapart.com/svn/djabberd/trunk/DJabberd
Visibility:
Public.

Description

There is a memory leak in SSL connections (both StartTLS and OldSSLClientIn) The context object created for the ssl stream needs to be freed when the connection closes. Net::SSLeay::CTX_free must be called on $ctx just like Net::SSLeay::free is called on $ssl I've also done a tiny bit of consolidation of code shared between StartTLS and OldSSLClientIn around the finalizing of SSL ------- patch 3 committed in http://code.sixapart.com/trac/djabberd/changeset/821

Patch Set 1 #

Patch Set 2 : fixes #

Patch Set 3 : oops, looks like the last upload I made was a patch for a different issue #

Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -26 lines) Patch
lib/DJabberd/Connection.pm View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
lib/DJabberd/Connection/OldSSLClientIn.pm View 1 1 chunk +1 line, -17 lines 0 comments Download
lib/DJabberd/Stanza/StartTLS.pm View 1 2 1 chunk +23 lines, -3 lines 0 comments Download

Messages

Total messages: 2
dangabrad
Overall, nice. Few nits. http://codereview.appspot.com/2326/diff/1/3 File lib/DJabberd/Stanza/StartTLS.pm (right): http://codereview.appspot.com/2326/diff/1/3#newcode51 Line 51: sub finalize_ssl_negotiation { A ...
16 years, 11 months ago (2008-06-20 05:53:44 UTC) #1
Jacob
16 years, 11 months ago (2008-06-23 18:44:40 UTC) #2
Hi, I've uploaded a new patch

http://codereview.appspot.com/2326/diff/1/3
File lib/DJabberd/Stanza/StartTLS.pm (right):

http://codereview.appspot.com/2326/diff/1/3#newcode51
Line 51: sub finalize_ssl_negotiation {
On 2008/06/20 05:53:45, bradfitz wrote:
> A little one-line or so comment above this function explaining when it's to be
> called and what it does would be nice.

Done.

http://codereview.appspot.com/2326/diff/1/3#newcode54
Line 54: #Net::SSLeay::set_verify($ssl, Net::SSLeay::VERIFY_PEER(), 0);
On 2008/06/20 05:53:45, bradfitz wrote:
> Feel free to remove this.  I hate commented out code... not sure why it was
left
> in before.

Done.

http://codereview.appspot.com/2326/diff/1/3#newcode61
Line 61: Net::SSLeay::CTX_free($ctx);
On 2008/06/20 05:53:45, bradfitz wrote:
> I believe there's another bug report that we should really only have one
global
> CTX object around and reusing it, rather than making one per connection.  If
we
> did that, then we wouldn't have to free the context object all the time too.
> 
> Feel free to add a comment to that effect.

Done.

http://codereview.appspot.com/2326/diff/1/3#newcode71
Line 71: #Net::SSLeay::connect($ssl) or Net::SSLeay::die_now("Failed SSL connect
($!)");
also removing this commented out line
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b