---
 src/peer.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/peer.go b/src/peer.go
index 228fe73..244bae0 100644
--- a/src/peer.go
+++ b/src/peer.go
@@ -83,6 +83,7 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, 
error) {
        // check if over limit
 
        if len(device.peers) >= MaxPeers {
+               device.mutex.Unlock()
                return nil, errors.New("Too many peers")
        }
 
@@ -90,6 +91,7 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, 
error) {
 
        _, ok := device.peers[pk]
        if ok {
+               device.mutex.Unlock()
                return nil, errors.New("Adding existing peer")
        }
        device.peers[pk] = peer
-- 
2.15.1

_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard

Reply via email to