mirror of
https://github.com/php/pecl-mail-mailparse.git
synced 2026-03-23 22:52:14 +01:00
Fix memory leak
This commit is contained in:
@@ -122,9 +122,7 @@ ZEND_RSRC_DTOR_FUNC(mimepart_dtor)
|
||||
{
|
||||
php_mimepart *part = res->ptr;
|
||||
|
||||
if (part->parent == NULL) {
|
||||
php_mimepart_free(part);
|
||||
}
|
||||
php_mimepart_free(part);
|
||||
}
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
|
||||
@@ -48,6 +48,7 @@ It can deal with rfc822 and rfc2045 (MIME) compliant messages.
|
||||
<license uri="https://www.php.net/license/3_01.txt" filesource="LICENSE">PHP-3.01</license>
|
||||
<notes>
|
||||
- use Zend/zend_smart_string.h for PHP 8.5
|
||||
- Fix memory leak
|
||||
</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
|
||||
@@ -318,7 +318,15 @@ PHP_MAILPARSE_API php_mimepart *php_mimepart_alloc()
|
||||
|
||||
PHP_MAILPARSE_API void php_mimepart_free(php_mimepart *part)
|
||||
{
|
||||
zval *childpart_z;
|
||||
HashPosition pos;
|
||||
|
||||
/* free contained parts */
|
||||
zend_hash_internal_pointer_reset_ex(&part->children, &pos);
|
||||
while ((childpart_z = zend_hash_get_current_data_ex(&part->children, &pos)) != NULL) {
|
||||
zval_ptr_dtor(childpart_z);
|
||||
zend_hash_move_forward_ex(&part->children, &pos);
|
||||
}
|
||||
|
||||
zend_hash_destroy(&part->children);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user