File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3194,6 +3194,7 @@ PHP_FUNCTION(openssl_csr_sign)
31943194 X509 * cert = NULL , * new_cert = NULL ;
31953195 EVP_PKEY * key = NULL , * priv_key = NULL ;
31963196 int i ;
3197+ bool new_cert_used = false;
31973198 struct php_x509_request req ;
31983199
31993200 ZEND_PARSE_PARAMETERS_START (4 , 6 )
@@ -3315,11 +3316,12 @@ PHP_FUNCTION(openssl_csr_sign)
33153316 object_init_ex (return_value , php_openssl_certificate_ce );
33163317 cert_object = Z_OPENSSL_CERTIFICATE_P (return_value );
33173318 cert_object -> x509 = new_cert ;
3319+ new_cert_used = true;
33183320
33193321cleanup :
33203322
3321- if (cert == new_cert ) {
3322- cert = NULL ;
3323+ if (! new_cert_used && new_cert ) {
3324+ X509_free ( new_cert ) ;
33233325 }
33243326
33253327 PHP_SSL_REQ_DISPOSE (& req );
@@ -3328,7 +3330,7 @@ PHP_FUNCTION(openssl_csr_sign)
33283330 if (csr_str ) {
33293331 X509_REQ_free (csr );
33303332 }
3331- if (cert_str && cert ) {
3333+ if (cert_str && cert && cert != new_cert ) {
33323334 X509_free (cert );
33333335 }
33343336}
You can’t perform that action at this time.
0 commit comments