Closed
Description
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