mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: check unsafe
V function calls (#8752)
This commit is contained in:
@@ -25,7 +25,7 @@ pub fn read(bytes_needed int) ?[]byte {
|
||||
}
|
||||
rbytes := getrandom(batch_size, bstart)
|
||||
if rbytes == -1 {
|
||||
free(buffer)
|
||||
unsafe { free(buffer) }
|
||||
return read_error
|
||||
}
|
||||
bytes_read += rbytes
|
||||
|
@@ -15,7 +15,7 @@ const (
|
||||
|
||||
// read returns an array of `bytes_needed` random bytes read from the OS.
|
||||
pub fn read(bytes_needed int) ?[]byte {
|
||||
mut buffer := malloc(bytes_needed)
|
||||
mut buffer := unsafe {malloc(bytes_needed)}
|
||||
// use bcrypt_use_system_preferred_rng because we passed null as algo
|
||||
status := C.BCryptGenRandom(0, buffer, bytes_needed, bcrypt_use_system_preferred_rng)
|
||||
if status != status_success {
|
||||
|
Reference in New Issue
Block a user