diff --git a/t/local/64_ticket_sharing.t b/t/local/64_ticket_sharing.t index e0adc2f..4d9865d 100644 --- a/t/local/64_ticket_sharing.t +++ b/t/local/64_ticket_sharing.t @@ -63,8 +63,9 @@ if (0) { Net::SSLeay::get_session($client->_ssl)); }; $reuse = sub { - Net::SSLeay::set_session($client->_ssl, - Net::SSLeay::d2i_SSL_SESSION($saved)); + my $sess = Net::SSLeay::d2i_SSL_SESSION($saved); + Net::SSLeay::set_session($client->_ssl, $sess); + Net::SSLeay::SESSION_free($sess); }; } @@ -278,11 +279,18 @@ sub _handshake { Net::SSLeay::BIO_new(Net::SSLeay::BIO_s_mem()), ); Net::SSLeay::set_bio($ssl,$bio[0],$bio[1]); + Net::SSLeay::free($self->{ssl}) if $self->{ssl}; # call SSL_free() on old ssl value; $self->{ssl} = $ssl; $self->{rbio} = $bio[0]; $self->{wbio} = $bio[1]; } + sub DESTROY { + my $self = shift; + Net::SSLeay::free($self->{ssl}) if $self->{ssl}; # call SSL_free() on old ssl value; + Net::SSLeay::CTX_free($self->{ctx}) if $self->{ctx}; # free old ctx value; + } + sub _error { my ($self,$rv) = @_; if ($rv>0) {