Skip to content

Commit

Permalink
defer mtx.Unlock()
Browse files Browse the repository at this point in the history
  • Loading branch information
fd committed May 16, 2013
1 parent 58bf64e commit 390fdd0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions static/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ func (tx *Tx) DstStore() store.Store {

func (tx *Tx) RegisterTerminator(name string, t Terminator) Terminator {
tx.mtx.Lock()
defer tx.mtx.Unlock()

if tx.terminators == nil {
tx.terminators = map[string]Terminator{}
}

if t := tx.terminators[name]; t != nil {
tx.mtx.Unlock()
return t
}

Expand All @@ -47,10 +47,8 @@ func (tx *Tx) RegisterTerminator(name string, t Terminator) Terminator {
err := t.Open(tx)
if err != nil {
tx.err.Add(err)
tx.mtx.Unlock()
return nil
}

tx.mtx.Unlock()
return t
}

0 comments on commit 390fdd0

Please sign in to comment.