From 4113509828cc925b11dbff857f0e3ee95b097f57 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 22 Sep 2015 23:25:07 -0700 Subject: [PATCH] storage/watchable_store: defer to Unlock s.mu New PR from https://github.com/coreos/etcd/pull/3575. This add `defer` to `s.mu`. Current code does not `Unlock` in the correct scope, I think. (Sorry, I accidentally deleted my fork so the changes might not sound continuous from my previous pull requests.) --- storage/watchable_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/watchable_store.go b/storage/watchable_store.go index 70ac596fc..83eba9120 100644 --- a/storage/watchable_store.go +++ b/storage/watchable_store.go @@ -177,7 +177,7 @@ func (s *watchableStore) Watcher(key []byte, prefix bool, startRev, endRev int64 cancel := CancelFunc(func() { s.mu.Lock() - s.mu.Unlock() + defer s.mu.Unlock() wa.stopWithError(ErrCanceled) // remove global references of the watcher