Move defered Unlock() before a possible function return.

This commit is contained in:
Josh Rickmar 2013-10-21 10:32:03 -04:00
parent 1d42efafad
commit b3d8f02395

View file

@ -752,13 +752,13 @@ func CreateEncryptedWallet(reply chan []byte, msg *btcjson.Message) {
// Does this wallet already exist?
wallets.Lock()
defer wallets.Unlock()
if w := wallets.m[wname]; w != nil {
e := WalletInvalidAccountName
e.Message = "Wallet already exists."
ReplyError(reply, msg.Id, &e)
return
}
defer wallets.Unlock()
var net btcwire.BitcoinNet
if cfg.MainNet {