Skip to content

There is a memory leak defect at line 1201 in the /php-src/ext/standard/streamsfuncs.c file. #18020

@LuMingYinDetect

Description

@LuMingYinDetect

Description

A pointer variable named context is defined at line 1189 in the /php-src/ext/standard/streamsfuncs.c file. At line 1197, a new dynamic memory region is allocated for context using the php_stream_context_alloc function. If the if statement at line 1200 evaluates to true, the function will return at line 1201. In this process, the dynamic memory region pointed to by context is neither used, as it is at line 1211, nor freed, resulting in a memory leak defect, as shown in the figure below.
https://github.com/LuMingYinDetect/php_defects/blob/main/php_5.png

The defect report was generated by a static analysis tool. Although it has undergone manual review and confirmation, false positives may still occur. If you identify any false positives, please let us know. We would greatly appreciate your help!

PHP Version

PHP 8.4.4

Operating System

Ubuntu 20.04

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