php / pecl-file_formats-yaml

YAML-1.1 parser and emitter
https://pecl.php.net/package/yaml
MIT License
72 stars 33 forks source link

Fixed memory release on error handling #72

Closed mikhainin closed 1 year ago

mikhainin commented 1 year ago

Running tests with PHP built with '--enable-debug' '--enable-debug-assertions', we discovered a few places when memory doesn't get released after an error.

Problematic tests:

tests/bug_77720.phpt

/opt/phpbuild/include/php/Zend/zend_string.h(144) :  Freeing 0x000000010a404c40 (32 bytes), script=/Users/mikhailgalanin/src/pecl-file_formats-yaml/tests/bug_77720.php
Last leak repeated 9 times

tests/yaml_parse_006.out


[Fri Feb 24 11:28:03 2023]  Script:  '/Users/mikhailgalanin/src/pecl-file_formats-yaml/tests/yaml_parse_006.php'
/Users/mikhailgalanin/repos/php-src/Zend/zend_hash.c(278) :  Freeing 0x0000000106601600 (56 bytes), script=/Users/mikhailgalanin/src/pecl-file_formats-yaml/tests/yaml_parse_006.php
Last leak repeated 1 time