Closed
Description
Description
At line 746 of the file /php-src/ext/phar/stream.c, a pointer variable named resource_to is defined. This pointer is allocated a new block of dynamic memory through the function phar_parse_url at line 772. If the if statement at line 772 evaluates to false, it indicates that the allocation of dynamic memory for resource_to was successful. When the if statement at line 783 returns true, the function exits at line 786. During this process, the dynamically allocated memory pointed to by resource_to, which was neither freed like at line 791 nor used, leads to a memory leak defect, as illustrated below:
https://github.com/LuMingYinDetect/php_defects/blob/main/php_4.png
PHP Version
PHP 8.4.0
Operating System
Ubuntu 22.04