Skip to content

Commit

Permalink
Fix context leak when socket is not cloed explicitly. See radiator-so…
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 7de0a77 commit 394d69f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Net/SSLeay/Handle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ sub TIEHANDLE {
return $self;
}

sub DESTROY {
my $self = shift;
# Cleanup contextes if they have not been cleaned while CLOSEing
Net::SSLeay::CTX_free ($self->{ctx}) if defined $self->{ctx};
Net::SSLeay::free ($self->{ssl}) if defined $self->{ssl};
}

sub PRINT {
my $self = shift;

Expand Down Expand Up @@ -156,6 +163,8 @@ sub CLOSE {
$Debug > 10 and print "close($fileno)\n";
Net::SSLeay::free ($self->{ssl});
Net::SSLeay::CTX_free ($self->{ctx});
undef $self->{ctx};
undef $self->{ssl};
close $self->{socket};
}

Expand Down

0 comments on commit 394d69f

Please sign in to comment.