@@ -1495,7 +1495,7 @@ PHP_FUNCTION(openssl_x509_export_to_file)
1495
1495
}
1496
1496
1497
1497
if (!php_openssl_check_path (filename , filename_len , file_path , 2 )) {
1498
- return ;
1498
+ goto exit_cleanup_cert ;
1499
1499
}
1500
1500
1501
1501
bio_out = BIO_new_file (file_path , PHP_OPENSSL_BIO_MODE_W (PKCS7_BINARY ));
@@ -1513,13 +1513,14 @@ PHP_FUNCTION(openssl_x509_export_to_file)
1513
1513
php_error_docref (NULL , E_WARNING , "Error opening file %s" , file_path );
1514
1514
}
1515
1515
1516
- if (cert_str ) {
1517
- X509_free (cert );
1518
- }
1519
-
1520
1516
if (!BIO_free (bio_out )) {
1521
1517
php_openssl_store_errors ();
1522
1518
}
1519
+
1520
+ exit_cleanup_cert :
1521
+ if (cert_str ) {
1522
+ X509_free (cert );
1523
+ }
1523
1524
}
1524
1525
/* }}} */
1525
1526
@@ -3070,7 +3071,7 @@ PHP_FUNCTION(openssl_csr_export_to_file)
3070
3071
}
3071
3072
3072
3073
if (!php_openssl_check_path (filename , filename_len , file_path , 2 )) {
3073
- return ;
3074
+ goto exit_cleanup ;
3074
3075
}
3075
3076
3076
3077
bio_out = BIO_new_file (file_path , PHP_OPENSSL_BIO_MODE_W (PKCS7_BINARY ));
@@ -3090,6 +3091,7 @@ PHP_FUNCTION(openssl_csr_export_to_file)
3090
3091
php_error_docref (NULL , E_WARNING , "Error opening file %s" , file_path );
3091
3092
}
3092
3093
3094
+ exit_cleanup :
3093
3095
if (csr_str ) {
3094
3096
X509_REQ_free (csr );
3095
3097
}
@@ -4567,7 +4569,7 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
4567
4569
}
4568
4570
4569
4571
if (!php_openssl_check_path (filename , filename_len , file_path , 2 )) {
4570
- RETURN_FALSE ;
4572
+ goto clean_exit_key ;
4571
4573
}
4572
4574
4573
4575
PHP_SSL_REQ_INIT (& req );
@@ -4603,8 +4605,9 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
4603
4605
4604
4606
clean_exit :
4605
4607
PHP_SSL_REQ_DISPOSE (& req );
4606
- EVP_PKEY_free (key );
4607
4608
BIO_free (bio_out );
4609
+ clean_exit_key :
4610
+ EVP_PKEY_free (key );
4608
4611
}
4609
4612
/* }}} */
4610
4613
0 commit comments