builtin,crypto: fix problems detected by -fsanitize=address,undefined and -fsanitize=memory

This commit is contained in:
Delyan Angelov 2021-11-28 20:35:18 +02:00
parent b4c52b72cf
commit 31fe02de8c
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
5 changed files with 28 additions and 19 deletions

View file

@ -506,7 +506,8 @@ pub fn (a &array) free() {
// if a.is_slice {
// return
// }
unsafe { free(&byte(a.data) - a.offset) }
mblock_ptr := &byte(u64(a.data) - u64(a.offset))
unsafe { free(mblock_ptr) }
}
// filter creates a new array with all elements that pass the test implemented by the provided function