p5-net-ssleay icon indicating copy to clipboard operation
p5-net-ssleay copied to clipboard

Fix context leak when socket is not cloed explicitly

Open nataraj-hates-MS-for-stealing-github opened this issue 1 year ago • 0 comments

Fix memory leak described in #469.

If this patch is applied, this module build with ASan enabled no longer fails on following sample:

use strict;
use Symbol qw(gensym);
use Net::SSLeay::Handle;

my @uris = ('ya.ru', 'google.com');
#my @uris = ('google.com');

for my $uri (@uris)
{
  my $ssl = gensym();
  tie(*$ssl, "Net::SSLeay::Handle", $uri, 443);
  print $ssl "GET / HTTP/1.0\r\n\r\n";

  my $response = do { local $/ = undef; <$ssl> };
}

This does not solves all ASan related problems, but reduces failed tests from 13 to 11 for me.