xref: /PHP-8.3/ext/openssl/tests/bug79145.phpt (revision 6249172a)
1--TEST--
2Bug #79145 (openssl memory leak)
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7$b = '-----BEGIN PUBLIC KEY-----
8MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDaFhc31WeskqxwI+Si5R/fZrLK
9pJOlABiI3RZfKCHJVrXl3IvcHDFM/BHKUJoSi/ee8GS9iw0G4Z1eCzJdthXxHARh
10j85Q5OliVxOdB1LoTOsOmfFf/fdvpU3DsOWsDKlVrL41MHxXorwrwOiys/r/gv2d
11C9C4JmhTOjBVAK8SewIDAQAC
12-----END PUBLIC KEY-----';
13
14$a = openssl_get_publickey($b);
15@openssl_free_key($a);
16
17$start = memory_get_usage(true);
18$a = openssl_get_publickey($b);
19@openssl_free_key($a);
20$end = memory_get_usage(true);
21var_dump($end == $start);
22?>
23--EXPECT--
24bool(true)
25