File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ PHP NEWS
11
11
- OpenSSL:
12
12
. Prevent unexpected array entry conversion when reading key. (nielsdos)
13
13
. Fix various memory leaks related to openssl exports. (nielsdos)
14
+ . Fix memory leak in php_openssl_pkey_from_zval(). (nielsdos)
14
15
15
16
- PDO:
16
17
. Fixed memory leak of `setFetchMode()`. (SakiTakamachi)
Original file line number Diff line number Diff line change @@ -3533,6 +3533,7 @@ static EVP_PKEY *php_openssl_pkey_from_zval(
3533
3533
} else {
3534
3534
ZVAL_COPY (& tmp , zphrase );
3535
3535
if (!try_convert_to_string (& tmp )) {
3536
+ zval_ptr_dtor (& tmp );
3536
3537
return NULL ;
3537
3538
}
3538
3539
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ php_openssl_pkey_from_zval memory leak
3
+ --EXTENSIONS--
4
+ openssl
5
+ --FILE--
6
+ <?php
7
+
8
+ class StrFail {
9
+ public function __toString (): string {
10
+ throw new Error ('create a leak ' );
11
+ }
12
+ }
13
+
14
+ $ key = ["" , new StrFail ];
15
+ try {
16
+ openssl_pkey_export_to_file ($ key , "doesnotmatter " );
17
+ } catch (Error $ e ) {
18
+ echo $ e ->getMessage (), "\n" ;
19
+ }
20
+
21
+ ?>
22
+ --EXPECT--
23
+ create a leak
You can’t perform that action at this time.
0 commit comments