Skip to content

Commit 47bec0c

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: phar: Fix memory leak of argument in webPhar
2 parents 1cb539d + 3b87850 commit 47bec0c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/phar/phar_object.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,15 @@ PHP_METHOD(Phar, webPhar)
697697
rewrite_fci.retval = &retval;
698698

699699
if (FAILURE == zend_call_function(&rewrite_fci, &rewrite_fcc)) {
700+
zval_ptr_dtor_str(&params);
700701
if (!EG(exception)) {
701702
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: failed to call rewrite callback");
702703
}
703704
goto cleanup_fail;
704705
}
705706

707+
zval_ptr_dtor_str(&params);
708+
706709
if (Z_TYPE_P(rewrite_fci.retval) == IS_UNDEF || Z_TYPE(retval) == IS_UNDEF) {
707710
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
708711
goto cleanup_fail;
@@ -728,7 +731,6 @@ PHP_METHOD(Phar, webPhar)
728731
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
729732

730733
cleanup_fail:
731-
zval_ptr_dtor(&params);
732734
if (free_pathinfo) {
733735
efree(path_info);
734736
}

0 commit comments

Comments
 (0)