Commit e34c8b7
committed
Filesystem API: Free the archive in
There are several early returns in `_unzip_file_ziparchive()` which don't close the archive prior to returning.
As this function is used in installation and upgrade processes which are memory-intensive, this calls `ZipArchive::close()` to free the archive prior to each early return. This excludes the first return which is a result of a failure to open the archive, which is [https://github.com/nih-at/libzip/blob/main/lib/zip_open.c#L62-L73 freed internally] when the failure occurs.
References:
- PHP.net: [https://www.php.net/manual/en/ziparchive.open.php ZipArchive::open()] and [https://www.php.net/manual/en/ziparchive.close.php ZipArchive::close()]
- libzip: [https://libzip.org/documentation/zip_open.html zip_open()] and [https://libzip.org/documentation/zip_close.html zip_close()]
Follow-up to: [13005], [13006], [13015], [13221], [14346] [25779].
Props azaozz, afragen, joemcgill, costdev.
Fixes #59467
git-svn-id: https://develop.svn.wordpress.org/trunk@56735 602fd350-edb4-49c9-b593-d223f7449a82_unzip_file_ziparchive().1 parent d740727 commit e34c8b7
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1672 | 1672 | | |
1673 | 1673 | | |
1674 | 1674 | | |
| 1675 | + | |
1675 | 1676 | | |
1676 | 1677 | | |
1677 | 1678 | | |
| |||
1709 | 1710 | | |
1710 | 1711 | | |
1711 | 1712 | | |
| 1713 | + | |
1712 | 1714 | | |
1713 | 1715 | | |
1714 | 1716 | | |
| |||
1746 | 1748 | | |
1747 | 1749 | | |
1748 | 1750 | | |
| 1751 | + | |
1749 | 1752 | | |
1750 | 1753 | | |
1751 | 1754 | | |
| |||
1774 | 1777 | | |
1775 | 1778 | | |
1776 | 1779 | | |
| 1780 | + | |
1777 | 1781 | | |
1778 | 1782 | | |
1779 | 1783 | | |
| |||
1793 | 1797 | | |
1794 | 1798 | | |
1795 | 1799 | | |
| 1800 | + | |
1796 | 1801 | | |
1797 | 1802 | | |
1798 | 1803 | | |
1799 | 1804 | | |
| 1805 | + | |
1800 | 1806 | | |
1801 | 1807 | | |
1802 | 1808 | | |
| |||
0 commit comments