This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch cid_1497421 in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 14b56cf30541349f46cc44fea5dc9e05bee11961 Author: Bryan Call <bc...@apache.org> AuthorDate: Wed Nov 22 09:37:52 2023 -0800 Coverity 1497421: Uninitialized scalar variable --- plugins/esi/common/gzip.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/esi/common/gzip.cc b/plugins/esi/common/gzip.cc index 57ec5d9652..1d7c3a26cf 100644 --- a/plugins/esi/common/gzip.cc +++ b/plugins/esi/common/gzip.cc @@ -79,9 +79,12 @@ EsiLib::gzip(const ByteBlockList &blocks, std::string &cdata) { cdata.assign(GZIP_HEADER_SIZE, 0); // reserving space for the header z_stream zstrm; - zstrm.zalloc = Z_NULL; - zstrm.zfree = Z_NULL; - zstrm.opaque = Z_NULL; + zstrm.zalloc = Z_NULL; + zstrm.zfree = Z_NULL; + zstrm.opaque = Z_NULL; + zstrm.total_in = 0; + zstrm.total_out = 0; + if (deflateInit2(&zstrm, COMPRESSION_LEVEL, Z_DEFLATED, -MAX_WBITS, ZLIB_MEM_LEVEL, Z_DEFAULT_STRATEGY) != Z_OK) { TSError("[%s] deflateInit2 failed!", __FUNCTION__); return false; @@ -104,10 +107,7 @@ EsiLib::gzip(const ByteBlockList &blocks, std::string &cdata) total_data_len += block.data_len; } } - if (!in_data_size) { - zstrm.avail_in = 0; // required for the "finish" loop as no data has been given so far - zstrm.total_out = 0; // required for the "finish" loop - } + if (deflate_result == Z_OK) { deflate_result = runDeflateLoop(zstrm, Z_FINISH, cdata); }