Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks problems in t/local/32_x509_get_cert_info.t reported by Assress Sanitizer #500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions t/local/32_x509_get_cert_info.t
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ for my $f (keys (%$dump)) {
my $filename = data_file_path($f);
ok(my $bio = Net::SSLeay::BIO_new_file($filename, 'rb'), "BIO_new_file\t$f");
ok(my $x509 = Net::SSLeay::PEM_read_bio_X509($bio), "PEM_read_bio_X509\t$f");
ok(Net::SSLeay::X509_get_pubkey($x509), "X509_get_pubkey\t$f"); #only test whether the function works
{
ok(my $pubkey = Net::SSLeay::X509_get_pubkey($x509), "X509_get_pubkey\t$f"); #only test whether the function works
Net::SSLeay::EVP_PKEY_free($pubkey);
}

ok(my $subj_name = Net::SSLeay::X509_get_subject_name($x509), "X509_get_subject_name\t$f");
is(my $subj_count = Net::SSLeay::X509_NAME_entry_count($subj_name), $dump->{$f}->{subject}->{count}, "X509_NAME_entry_count\t$f");
Expand Down Expand Up @@ -352,7 +355,9 @@ for my $f (keys (%$dump)) {
skip('EVP_PKEY_id requires OpenSSL 1.0.0+', 1) unless Net::SSLeay::SSLeay >= 0x1000000f;
is(Net::SSLeay::EVP_PKEY_id($pubkey), $dump->{$f}->{pubkey_id}, "EVP_PKEY_id");
}

Net::SSLeay::EVP_PKEY_free($pubkey);
Net::SSLeay::X509_free($x509);
Net::SSLeay::BIO_free($bio);
}

my $ctx = Net::SSLeay::X509_STORE_CTX_new();
Expand Down