diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-03 18:25:09 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-03 18:32:18 -0700 |
commit | 524799058dcc2fb25bf9a5bed49fa38e9b9ac387 (patch) | |
tree | c302a5e823442b4e6abbc4e058efed3b391bdb95 /tensorflow/core/lib/io | |
parent | 76c9af7e37709015ed51ee828010dcee925eb12e (diff) |
Change PyRecordWriter destructor order so that file_ is still available for writing when writer_ destructor is called
PiperOrigin-RevId: 207355721
Diffstat (limited to 'tensorflow/core/lib/io')
-rw-r--r-- | tensorflow/core/lib/io/zlib_outputbuffer.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tensorflow/core/lib/io/zlib_outputbuffer.cc b/tensorflow/core/lib/io/zlib_outputbuffer.cc index 4a6bedbad8..84b47c171f 100644 --- a/tensorflow/core/lib/io/zlib_outputbuffer.cc +++ b/tensorflow/core/lib/io/zlib_outputbuffer.cc @@ -203,10 +203,12 @@ Status ZlibOutputBuffer::Sync() { } Status ZlibOutputBuffer::Close() { - TF_RETURN_IF_ERROR(DeflateBuffered(true)); - TF_RETURN_IF_ERROR(FlushOutputBufferToFile()); - deflateEnd(z_stream_.get()); - z_stream_.reset(nullptr); + if (z_stream_) { + TF_RETURN_IF_ERROR(DeflateBuffered(true)); + TF_RETURN_IF_ERROR(FlushOutputBufferToFile()); + deflateEnd(z_stream_.get()); + z_stream_.reset(nullptr); + } return Status::OK(); } |