Repository: trafficserver Updated Branches: refs/heads/master 60500b151 -> c10e7473e
TS-1475: Fix bug where local buffer might still be referenced. Coverity #1200049 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c10e7473 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c10e7473 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c10e7473 Branch: refs/heads/master Commit: c10e7473e91368ee890ce870d0d12419e408f842 Parents: 60500b1 Author: Brian Geffon <[email protected]> Authored: Mon Jul 14 14:44:17 2014 -0700 Committer: Brian Geffon <[email protected]> Committed: Mon Jul 14 14:44:17 2014 -0700 ---------------------------------------------------------------------- lib/atscppapi/src/GzipDeflateTransformation.cc | 3 +++ 1 file changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c10e7473/lib/atscppapi/src/GzipDeflateTransformation.cc ---------------------------------------------------------------------- diff --git a/lib/atscppapi/src/GzipDeflateTransformation.cc b/lib/atscppapi/src/GzipDeflateTransformation.cc index 3b70c02..5ee9f66 100644 --- a/lib/atscppapi/src/GzipDeflateTransformation.cc +++ b/lib/atscppapi/src/GzipDeflateTransformation.cc @@ -104,6 +104,7 @@ void GzipDeflateTransformation::consume(const string &data) { int err = deflate(&state_->z_stream_, Z_SYNC_FLUSH); if (Z_OK != err) { + state_->z_stream_.next_out = NULL; LOG_ERROR("Iteration %d: Deflate failed to compress %ld bytes with error code '%d'", iteration, data.size(), err); return; } @@ -115,6 +116,8 @@ void GzipDeflateTransformation::consume(const string &data) { produce(string(reinterpret_cast<char *>(&buffer[0]), static_cast<size_t>(bytes_to_write))); } while (state_->z_stream_.avail_out == 0); + state_->z_stream_.next_out = NULL; + if (state_->z_stream_.avail_in != 0) { LOG_ERROR("Inflate finished with data still remaining in the buffer of size '%u'", state_->z_stream_.avail_in); }
