You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
There is a memory leak defect at line 2214 in /php-src/main/streams/streams.c. #15026
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
No problem, thanks for the other reports btw.
I have opened a PR to add an assertion that the path is NULL in case an exception was thrown. This should make the developer intent clear and prevent further reports of this.
No problem, thanks for the other reports btw. I have opened a PR to add an assertion that the path is NULL in case an exception was thrown. This should make the developer intent clear and prevent further reports of this.
I am happy to contribute to PHP. In fact, receiving prompt responses from developers helps us improve our static analysis tool more effectively, ensuring better outcomes.Currently, our static analysis tool still has some bugs. Thank you very much for your feedback on false positives!
Activity
ndossche commentedon Jul 19, 2024
Hmm, isn't resolved_path NULL when EG(exception) is set? Otherwise how could we have an exception and a path at the same time?
LuMingYinDetect commentedon Jul 19, 2024
Thank you for your prompt reply! I didn't notice this issue when verifying the defect report; it should be a false alarm.
ndossche commentedon Jul 19, 2024
No problem, thanks for the other reports btw.
I have opened a PR to add an assertion that the path is NULL in case an exception was thrown. This should make the developer intent clear and prevent further reports of this.
LuMingYinDetect commentedon Jul 19, 2024
I am happy to contribute to PHP. In fact, receiving prompt responses from developers helps us improve our static analysis tool more effectively, ensuring better outcomes.Currently, our static analysis tool still has some bugs. Thank you very much for your feedback on false positives!
ndossche commentedon Sep 16, 2024
@LuMingYinDetect Turns out this is in fact a true positive, see #15908. I'll make sure to credit you in the test file.
Fix phpGH-15908 and phpGH-15026: leak / assertion failure in streams.c
LuMingYinDetect commentedon Sep 17, 2024
Thank you for your patient response! We greatly appreciate your affirmation of our work!
Fix GH-15908 and GH-15026: leak / assertion failure in streams.c
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'