1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: fix a warning for -d debug_realloc

This commit is contained in:
Delyan Angelov 2021-01-14 12:28:49 +02:00
parent ca5f88eb7d
commit 9003ea7ca3
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -198,10 +198,12 @@ pub fn v_realloc(b byteptr, n int) byteptr {
// 4) free the old block
// => if there is still a pointer to the old block somewhere
// it will point to memory that is now filled with 0x57.
new_ptr = malloc(n)
C.memcpy(new_ptr, b, n)
C.memset(b, 0x57, n)
C.free(b)
unsafe {
new_ptr = malloc(n)
C.memcpy(new_ptr, b, n)
C.memset(b, 0x57, n)
C.free(b)
}
} $else {
new_ptr = unsafe { C.realloc(b, n) }
if new_ptr == 0 {