@@ -1612,9 +1612,7 @@ PHP_FUNCTION(openssl_spki_new)
1612
1612
goto cleanup ;
1613
1613
1614
1614
cleanup :
1615
- if (pkey != NULL ) {
1616
- EVP_PKEY_free (pkey );
1617
- }
1615
+ EVP_PKEY_free (pkey );
1618
1616
if (spki != NULL ) {
1619
1617
NETSCAPE_SPKI_free (spki );
1620
1618
}
@@ -1669,9 +1667,7 @@ PHP_FUNCTION(openssl_spki_verify)
1669
1667
if (spki != NULL ) {
1670
1668
NETSCAPE_SPKI_free (spki );
1671
1669
}
1672
- if (pkey != NULL ) {
1673
- EVP_PKEY_free (pkey );
1674
- }
1670
+ EVP_PKEY_free (pkey );
1675
1671
if (spkstr_cleaned != NULL ) {
1676
1672
efree (spkstr_cleaned );
1677
1673
}
@@ -1738,12 +1734,8 @@ PHP_FUNCTION(openssl_spki_export)
1738
1734
if (spki != NULL ) {
1739
1735
NETSCAPE_SPKI_free (spki );
1740
1736
}
1741
- if (out != NULL ) {
1742
- BIO_free_all (out );
1743
- }
1744
- if (pkey != NULL ) {
1745
- EVP_PKEY_free (pkey );
1746
- }
1737
+ BIO_free_all (out );
1738
+ EVP_PKEY_free (pkey );
1747
1739
if (spkstr_cleaned != NULL ) {
1748
1740
efree (spkstr_cleaned );
1749
1741
}
@@ -2627,10 +2619,7 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
2627
2619
php_sk_X509_free (ca );
2628
2620
2629
2621
cleanup :
2630
-
2631
- if (priv_key ) {
2632
- EVP_PKEY_free (priv_key );
2633
- }
2622
+ EVP_PKEY_free (priv_key );
2634
2623
2635
2624
if (cert_str ) {
2636
2625
X509_free (cert );
@@ -2719,10 +2708,7 @@ PHP_FUNCTION(openssl_pkcs12_export)
2719
2708
php_sk_X509_free (ca );
2720
2709
2721
2710
cleanup :
2722
-
2723
- if (priv_key ) {
2724
- EVP_PKEY_free (priv_key );
2725
- }
2711
+ EVP_PKEY_free (priv_key );
2726
2712
if (cert_str ) {
2727
2713
X509_free (cert );
2728
2714
}
@@ -2822,13 +2808,9 @@ PHP_FUNCTION(openssl_pkcs12_read)
2822
2808
php_openssl_store_errors ();
2823
2809
}
2824
2810
2825
- cleanup :
2826
- if (bio_in ) {
2827
- BIO_free (bio_in );
2828
- }
2829
- if (pkey ) {
2830
- EVP_PKEY_free (pkey );
2831
- }
2811
+ cleanup :
2812
+ BIO_free (bio_in );
2813
+ EVP_PKEY_free (pkey );
2832
2814
if (cert ) {
2833
2815
X509_free (cert );
2834
2816
}
@@ -3300,13 +3282,8 @@ PHP_FUNCTION(openssl_csr_sign)
3300
3282
}
3301
3283
3302
3284
PHP_SSL_REQ_DISPOSE (& req );
3303
-
3304
- if (priv_key ) {
3305
- EVP_PKEY_free (priv_key );
3306
- }
3307
- if (key ) {
3308
- EVP_PKEY_free (key );
3309
- }
3285
+ EVP_PKEY_free (priv_key );
3286
+ EVP_PKEY_free (key );
3310
3287
if (csr_str ) {
3311
3288
X509_REQ_free (csr );
3312
3289
}
@@ -4265,9 +4242,7 @@ PHP_FUNCTION(openssl_pkey_new)
4265
4242
if (eckey != NULL ) {
4266
4243
EC_KEY_free (eckey );
4267
4244
}
4268
- if (pkey != NULL ) {
4269
- EVP_PKEY_free (pkey );
4270
- }
4245
+ EVP_PKEY_free (pkey );
4271
4246
RETURN_FALSE ;
4272
4247
#endif
4273
4248
}
@@ -4367,13 +4342,8 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
4367
4342
4368
4343
clean_exit :
4369
4344
PHP_SSL_REQ_DISPOSE (& req );
4370
-
4371
- if (key ) {
4372
- EVP_PKEY_free (key );
4373
- }
4374
- if (bio_out ) {
4375
- BIO_free (bio_out );
4376
- }
4345
+ EVP_PKEY_free (key );
4346
+ BIO_free (bio_out );
4377
4347
}
4378
4348
/* }}} */
4379
4349
@@ -4448,13 +4418,8 @@ PHP_FUNCTION(openssl_pkey_export)
4448
4418
}
4449
4419
}
4450
4420
PHP_SSL_REQ_DISPOSE (& req );
4451
-
4452
- if (key ) {
4453
- EVP_PKEY_free (key );
4454
- }
4455
- if (bio_out ) {
4456
- BIO_free (bio_out );
4457
- }
4421
+ EVP_PKEY_free (key );
4422
+ BIO_free (bio_out );
4458
4423
}
4459
4424
/* }}} */
4460
4425
@@ -4789,12 +4754,8 @@ PHP_FUNCTION(openssl_pkey_derive)
4789
4754
}
4790
4755
4791
4756
cleanup :
4792
- if (pkey ) {
4793
- EVP_PKEY_free (pkey );
4794
- }
4795
- if (peer_key ) {
4796
- EVP_PKEY_free (peer_key );
4797
- }
4757
+ EVP_PKEY_free (pkey );
4758
+ EVP_PKEY_free (peer_key );
4798
4759
if (ctx ) {
4799
4760
EVP_PKEY_CTX_free (ctx );
4800
4761
}
@@ -5231,9 +5192,7 @@ PHP_FUNCTION(openssl_pkcs7_read)
5231
5192
RETVAL_TRUE ;
5232
5193
5233
5194
clean_exit :
5234
- if (bio_in != NULL ) {
5235
- BIO_free (bio_in );
5236
- }
5195
+ BIO_free (bio_in );
5237
5196
5238
5197
if (p7 != NULL ) {
5239
5198
PKCS7_free (p7 );
@@ -5359,9 +5318,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
5359
5318
if (others ) {
5360
5319
sk_X509_pop_free (others , X509_free );
5361
5320
}
5362
- if (privkey ) {
5363
- EVP_PKEY_free (privkey );
5364
- }
5321
+ EVP_PKEY_free (privkey );
5365
5322
if (cert && cert_str ) {
5366
5323
X509_free (cert );
5367
5324
}
@@ -5441,9 +5398,7 @@ PHP_FUNCTION(openssl_pkcs7_decrypt)
5441
5398
if (cert && free_recipcert ) {
5442
5399
X509_free (cert );
5443
5400
}
5444
- if (key ) {
5445
- EVP_PKEY_free (key );
5446
- }
5401
+ EVP_PKEY_free (key );
5447
5402
}
5448
5403
/* }}} */
5449
5404
@@ -6191,9 +6146,7 @@ PHP_FUNCTION(openssl_cms_decrypt)
6191
6146
if (cert && free_recipcert ) {
6192
6147
X509_free (cert );
6193
6148
}
6194
- if (key ) {
6195
- EVP_PKEY_free (key );
6196
- }
6149
+ EVP_PKEY_free (key );
6197
6150
}
6198
6151
/* }}} */
6199
6152
0 commit comments