Skip to content

Commit 3b87850

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: phar: Fix memory leak of argument in webPhar
2 parents 990e05e + da39975 commit 3b87850

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ PHP NEWS
1717
. Fixed bug GH-20081 (access to uninitialized vars in preload_load()).
1818
(Arnaud)
1919

20+
- Phar:
21+
. Fix memory leak of argument in webPhar. (nielsdos)
22+
2023
- Random:
2124
. Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos)
2225

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)