forked from TrueCloudLab/rclone
compress: fix memory leak - fixes #6013
Before this change we forgot to close the compressor when checking to see if an object was compressible.
This commit is contained in:
parent
21355b4208
commit
e0fbca02d4
1 changed files with 4 additions and 0 deletions
|
@ -401,6 +401,10 @@ func isCompressible(r io.Reader) (bool, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
err = w.Close()
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
ratio := float64(n) / float64(b.Len())
|
ratio := float64(n) / float64(b.Len())
|
||||||
return ratio > minCompressionRatio, nil
|
return ratio > minCompressionRatio, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue