zip_close failed cause filesystem handle to leak.
Johnxjj opened this issue · 3 comments
Johnxjj commented
I see that zip_close fails, it fails to return from here:
if (_zip_read_local_ef(za, i) < 0) {
error = 1;
break;
}
then return,
if (error) {
zip_source_rollback_write(za->src);
return -1;
}
and I observe that it does not close the zip file, this cause my filesystem handle to leak.
Johnxjj commented
I'm not familiar with libzip, is that because of the way I use it?
dillof commented
As stated in the documentation:
If successful, archive is freed. Otherwise archive is left unchanged and must still be freed.
So, in case of error, you have to call zip_discard()
to close the archive.
Johnxjj commented
Thank you very much for your reply, it helped me a lot!