Fix PKCS12 leak in openssl
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Jun 2019 13:00:25 +0000 (15:00 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Jun 2019 13:07:37 +0000 (15:07 +0200)
ext/openssl/openssl.c

index c1560fa884bda2d2c06d40b5f5969a43591d31b0..6c1dd9d3435d87c8568e6ad8d82b6868f13972cc 100644 (file)
@@ -3029,8 +3029,6 @@ PHP_FUNCTION(openssl_pkcs12_read)
                }
 
                RETVAL_TRUE;
-
-               PKCS12_free(p12);
        } else {
                php_openssl_store_errors();
        }
@@ -3045,6 +3043,9 @@ PHP_FUNCTION(openssl_pkcs12_read)
        if (cert) {
                X509_free(cert);
        }
+       if (p12) {
+               PKCS12_free(p12);
+       }
 }
 /* }}} */