@@ -213,7 +213,11 @@ func (z *Writer) Flush() error {
return nil
}
- return z.compressBlock(z.data[:z.idx])
+ if err := z.compressBlock(z.data[:z.idx]); err != nil {
+ return err
+ }
+ z.idx = 0
+ return nil
// Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.