diff --git a/NEWS b/NEWS index 20e01b035f5..6b8c815d2a1 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,7 @@ PHP NEWS . Fix potential buffer length truncation due to usage of type int instead of type size_t. (Girgias) . Fix memory leak when openssl polyfill returns garbage. (nielsdos) + . Fix file descriptor leak in phar_zip_flush() on failure. (nielsdos) - Random: . Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos) diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 8845ef5a0f7..026fe3935c5 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -1276,6 +1276,7 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def return; } if (phar->alias_len != php_stream_write(entry.fp, phar->alias, phar->alias_len)) { + php_stream_close(entry.fp); if (error) { spprintf(error, 0, "unable to set alias in zip-based phar \"%s\"", phar->fname); }