aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/erasure_coding/ec_shard.go
diff options
context:
space:
mode:
authorNikita Mochalov <Zamony@users.noreply.github.com>2023-08-10 01:30:36 +0300
committerGitHub <noreply@github.com>2023-08-09 15:30:36 -0700
commite6a49dc5337bb73a6334647bb34a44570b3ef6d7 (patch)
tree238a2b7e5ba2c80427cf7898e521e62b8bd8977e /weed/storage/erasure_coding/ec_shard.go
parent3365468d0d683f61a915eebce06cc8c54ecd1dd6 (diff)
downloadseaweedfs-e6a49dc5337bb73a6334647bb34a44570b3ef6d7.tar.xz
seaweedfs-e6a49dc5337bb73a6334647bb34a44570b3ef6d7.zip
Fix resource leaks (#4737)
* Fix division by zero * Fix file handle leak * Fix file handle leak * Fix file handle leak * Fix goroutine leak
Diffstat (limited to 'weed/storage/erasure_coding/ec_shard.go')
-rw-r--r--weed/storage/erasure_coding/ec_shard.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/storage/erasure_coding/ec_shard.go b/weed/storage/erasure_coding/ec_shard.go
index f43280fb1..19ee17636 100644
--- a/weed/storage/erasure_coding/ec_shard.go
+++ b/weed/storage/erasure_coding/ec_shard.go
@@ -2,7 +2,6 @@ package erasure_coding
import (
"fmt"
- "github.com/seaweedfs/seaweedfs/weed/storage/types"
"os"
"path"
"strconv"
@@ -10,6 +9,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/stats"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
+ "github.com/seaweedfs/seaweedfs/weed/storage/types"
)
type ShardId uint8
@@ -39,6 +39,7 @@ func NewEcVolumeShard(diskType types.DiskType, dirname string, collection string
}
ecdFi, statErr := v.ecdFile.Stat()
if statErr != nil {
+ _ = v.ecdFile.Close()
return nil, fmt.Errorf("can not stat ec volume shard %s%s: %v", baseFileName, ToExt(int(shardId)), statErr)
}
v.ecdFileSize = ecdFi.Size()