Skip to content

Commit c89f25b

Browse files
committed
phar: Fix file descriptor/memory leak when opening central fp fails
Closes GH-20145.
1 parent 8a21d62 commit c89f25b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ PHP NEWS
2323
. Fix memory leak of argument in webPhar. (nielsdos)
2424
. Fix memory leak when setAlias() fails. (nielsdos)
2525
. Fix memory leak in phar_parse_zipfile() error handling. (nielsdos)
26+
. Fix file descriptor/memory leak when opening central fp fails. (nielsdos)
2627

2728
- Random:
2829
. Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos)

ext/phar/zip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int
14171417
pass.centralfp = php_stream_fopen_tmpfile();
14181418

14191419
if (!pass.centralfp) {
1420+
php_stream_close(pass.filefp);
14201421
goto fperror;
14211422
}
14221423

0 commit comments

Comments
 (0)