From 9ce1c23a10036e80e12f1a6fea8483f14b975d6f Mon Sep 17 00:00:00 2001 From: Thomas Klausner Date: Mon, 2 Dec 2024 20:57:28 +0100 Subject: [PATCH] Fix resource leak. Coverity CID 1635798. --- lib/zip_close.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/zip_close.c b/lib/zip_close.c index decc5d65a..3d586cc5f 100644 --- a/lib/zip_close.c +++ b/lib/zip_close.c @@ -515,11 +515,13 @@ static int add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t /* as long as we don't support non-seekable output, clear data descriptor bit */ if ((is_zip64 = _zip_dirent_write(za, de, flags)) < 0) { + zip_source_free(src_final); return -1; } if ((offdata = zip_source_tell_write(za->src)) < 0) { zip_error_set_from_source(&za->error, za->src); + zip_source_free(src_final); return -1; }