Bug #76524 [Opn->Csd]: ZipArchive memory leak (OVERWRITE flag and empty archive)

From: Date: Tue, 10 Jul 2018 09:21:21 +0000
Subject: Bug #76524 [Opn->Csd]: ZipArchive memory leak (OVERWRITE flag and empty archive)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216252@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76524&edit=1 ID: 76524 Updated by: ab@php.net Reported by: timok at ya dot ru Summary: ZipArchive memory leak (OVERWRITE flag and empty archive) -Status: Open +Status: Closed Type: Bug Package: Zip Related PHP Version: 5.6.36 Block user comment: N Private report: N New Comment: Automatic comment on behalf of timok@ya.ru Revision: http://git.php.net/?p=php-src.git;a=commit;h=08f08858f3bc62fac9150ca5b669df060b5af5a5 Log: Fix bug #76524 - ZipArchive memory leak Previous Comments: ------------------------------------------------------------------------ [2018-06-28 17:59:37] cmb@php.net PR: <https://github.com/php/php-src/pull/3330>. ------------------------------------------------------------------------ [2018-06-24 18:43:04] timok at ya dot ru Description: ------------ The memory leak occurs when - ZipArchive is opened with ZipArchive::CREATE|ZipArchive::OVERWRITE flags, - it's empty, - it's destroyed without explicit close() method call. The leak does not occur if zip-file already exist. All PHP versions are affected. Test script: --------------- $zip = new ZipArchive(); $zip->open(__DIR__.'/nonexistent.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); Expected result: ---------------- Done Warning: Unknown: Cannot destroy the zip context in Unknown on line 0 Actual result: -------------- Done Warning: Unknown: Cannot destroy the zip context in Unknown on line 0 [Sun Jun 24 20:52:32 2018] Script: '...' /.../php-src/ext/zip/php_zip.c(1141) : Freeing 0x7FED6E9998B8 (80 bytes), script=... [Sun Jun 24 20:52:32 2018] Script: '...' /.../php-src/main/fopen_wrappers.c(808) : Freeing 0x7FED6E99A090 (41 bytes), script=... === Total 2 memory leaks detected === ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76524&edit=1

« previous php.bugs (#216252) next »