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:
parent
0c2e6b3637
commit
2e3dc2cc35
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user