1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:24:39 -07:00

crypto/rand: add missing Unlock

R=r
CC=golang-dev
https://golang.org/cl/1812043
This commit is contained in:
Russ Cox 2010-07-13 12:37:47 -07:00
parent 0c2e6b3637
commit 2e3dc2cc35
2 changed files with 2 additions and 0 deletions

View File

@ -32,6 +32,7 @@ func (r *devReader) Read(b []byte) (n int, err os.Error) {
if r.f == nil {
f, err := os.Open(r.name, os.O_RDONLY, 0)
if f == nil {
r.mu.Unlock()
return 0, err
}
r.f = f

View File

@ -30,6 +30,7 @@ func (r *rngReader) Read(b []byte) (n int, err os.Error) {
const flags = syscall.CRYPT_VERIFYCONTEXT | syscall.CRYPT_SILENT
ok, errno := syscall.CryptAcquireContext(&r.prov, nil, nil, provType, flags)
if !ok {
r.mu.Unlock()
return 0, os.NewSyscallError("CryptAcquireContext", errno)
}
}