diff --git a/datachannel.go b/datachannel.go index 52de821b7e5..ea50a031feb 100644 --- a/datachannel.go +++ b/datachannel.go @@ -464,10 +464,12 @@ func (d *DataChannel) DetachWithDeadline() (datachannel.ReadWriteCloserDeadliner d.mu.Lock() if !d.api.settingEngine.detach.DataChannels { + d.mu.Unlock() return nil, errDetachNotEnabled } if d.dataChannel == nil { + d.mu.Unlock() return nil, errDetachBeforeOpened }