List Archive


Thread Index


From: Andreas Falkenhahn <>
To: Dieter Baron <>
Subject: Re: Libzip leaks
Date: Mon, 20 Nov 2017 16:27:45 +0100

On 20.11.2017 at 09:25 Dieter Baron wrote:

>> On 10.11.2017, at 09:26 , Dieter Baron <> wrote:

>>> On 09.11.2017, at 17:42 , Andreas Falkenhahn 
>>> <> wrote:

>>> I've just noticed that if the call to zip_source_commit_write() in 
>>> zip_close.c
>>> fails for whatever reason, the zip source callback's ZIP_SOURCE_FREE command
>>> is never invoked which can cause potential leaks. Should be fixed so that 
>>> the
>>> source can cleanup no matter if committing succeeded or not.

>> Thanks for reporting this, I just fixed it in hg.

> There was no bug in libzip, I just introduced one in trying to fix
> it: If zip_close(za) fails, za remains valid, and thus the
> underlying source is not freed. You have to call zip_discard(za) yourself.

Sorry, didn't know this. I probably was confused by the name zip_discard()
which doesn't sound like a generic cleanup function. I'd expect a name like
zip_free() here. Maybe a note can be added to zip_close() that it is necessary
to call zip_discard() in case zip_close() fails. Then it is clear for

Best regards,
 Andreas Falkenhahn                   

Made by MHonArc.