Skip to content

There is a memory leak defect at line 786 in the file /php-src/ext/phar/stream.c. #15028

Closed

Description

@LuMingYinDetect

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

Activity

  1. added a commit that references this issue on Jul 19, 2024
    fdb3478
  2. added 2 commits that reference this issue on Jul 19, 2024
    5996227
    f21947a
  3. added a commit that references this issue on Jul 19, 2024
    442ae96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions