]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/Certificate.pm
fix #3259: always free certificate file after reading it
[pve-common.git] / src / PVE / Certificate.pm
index 5bc9848f15bbe7cf13eb05b16272358267bfba49..31a77223f83c556e393be3a3165ea168eda5ae1d 100644 (file)
@@ -199,10 +199,8 @@ my $read_certificate = sub {
        or $ssl_die->("unable to read '$cert_path' - $!\n");
 
     my $cert = Net::SSLeay::PEM_read_bio_X509($bio);
-    if (!$cert) {
-       Net::SSLeay::BIO_free($bio);
-       die "unable to read certificate from '$cert_path'\n";
-    }
+    Net::SSLeay::BIO_free($bio);
+    die "unable to read certificate from '$cert_path'\n" if !$cert;
 
     return $cert;
 };