fix nil ptr in close() (#1005)

This commit is contained in:
Alex Sharov 2023-06-01 16:10:34 +07:00 committed by GitHub
parent 9a408d5d41
commit 4935e56e9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,13 +339,14 @@ func (d *Decompressor) ModTime() time.Time {
return d.modTime
}
func (d *Decompressor) Close() {
func (d *Decompressor) Close() error {
if err := mmap.Munmap(d.mmapHandle1, d.mmapHandle2); err != nil {
log.Trace("unmap", "err", err, "file", d.FileName())
}
if err := d.f.Close(); err != nil {
log.Trace("Decompressor.Close", "err", err, "file", d.FileName())
return err
}
return nil
}
func (d *Decompressor) FilePath() string { return d.filePath }