Skip to content

Commit 862b431

Browse files
committed
Prevent mutex leak
1 parent 7efd5aa commit 862b431

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

storage.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type ConsulStorage struct {
2121
certmagic.Storage
2222
ConsulClient *consul.Client
2323
logger *zap.SugaredLogger
24-
muLocks sync.RWMutex
24+
muLocks *sync.RWMutex
2525
locks map[string]*consul.Lock
2626

2727
Address string `json:"address"`
@@ -43,6 +43,7 @@ func New() *ConsulStorage {
4343
ValuePrefix: DefaultValuePrefix,
4444
Prefix: DefaultPrefix,
4545
Timeout: DefaultTimeout,
46+
muLocks: &sync.RWMutex{},
4647
}
4748

4849
return &s

0 commit comments

Comments
 (0)