Commit 2e3dc2cc authored by Russ Cox's avatar Russ Cox

crypto/rand: add missing Unlock

R=r
CC=golang-dev
https://golang.org/cl/1812043
parent 0c2e6b36
...@@ -32,6 +32,7 @@ func (r *devReader) Read(b []byte) (n int, err os.Error) { ...@@ -32,6 +32,7 @@ func (r *devReader) Read(b []byte) (n int, err os.Error) {
if r.f == nil { if r.f == nil {
f, err := os.Open(r.name, os.O_RDONLY, 0) f, err := os.Open(r.name, os.O_RDONLY, 0)
if f == nil { if f == nil {
r.mu.Unlock()
return 0, err return 0, err
} }
r.f = f r.f = f
......
...@@ -30,6 +30,7 @@ func (r *rngReader) Read(b []byte) (n int, err os.Error) { ...@@ -30,6 +30,7 @@ func (r *rngReader) Read(b []byte) (n int, err os.Error) {
const flags = syscall.CRYPT_VERIFYCONTEXT | syscall.CRYPT_SILENT const flags = syscall.CRYPT_VERIFYCONTEXT | syscall.CRYPT_SILENT
ok, errno := syscall.CryptAcquireContext(&r.prov, nil, nil, provType, flags) ok, errno := syscall.CryptAcquireContext(&r.prov, nil, nil, provType, flags)
if !ok { if !ok {
r.mu.Unlock()
return 0, os.NewSyscallError("CryptAcquireContext", errno) return 0, os.NewSyscallError("CryptAcquireContext", errno)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment