[php-src] Issue #15026: There is a memory leak defect at line 2214 in /php-src/main/streams/streams.c.
| From: | LuMingYinDetect | Date: | Fri, 19 Jul 2024 11:51:39 +0000 |
| Subject: | [php-src] Issue #15026: There is a memory leak defect at line 2214 in /php-src/main/streams/streams.c. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247319@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15026
Author: LuMingYinDetect
### Description
A pointer variable named resolved_path is defined at line 2186 in the file
/php-src/main/streams/streams.c. This variable is allocated a block of dynamic memory via the
function php_resolve_path at line 2205. When the if statement at line 2213 evaluates to true, the
function returns at line 2214. However, unlike at line 2224 where the dynamically allocated memory
pointed to by resolved_path is freed before returning, in this case, it leads to a memory leak
defect, as illustrated below:
https://github.com/LuMingYinDetect/php_defects/blob/main/php_3.png
### PHP Version
PHP 8.4.0
### Operating System
Ubuntu 22.04