builtin: fix a warning for `-d debug_realloc`
parent
ca5f88eb7d
commit
9003ea7ca3
|
@ -198,10 +198,12 @@ pub fn v_realloc(b byteptr, n int) byteptr {
|
||||||
// 4) free the old block
|
// 4) free the old block
|
||||||
// => if there is still a pointer to the old block somewhere
|
// => if there is still a pointer to the old block somewhere
|
||||||
// it will point to memory that is now filled with 0x57.
|
// it will point to memory that is now filled with 0x57.
|
||||||
new_ptr = malloc(n)
|
unsafe {
|
||||||
C.memcpy(new_ptr, b, n)
|
new_ptr = malloc(n)
|
||||||
C.memset(b, 0x57, n)
|
C.memcpy(new_ptr, b, n)
|
||||||
C.free(b)
|
C.memset(b, 0x57, n)
|
||||||
|
C.free(b)
|
||||||
|
}
|
||||||
} $else {
|
} $else {
|
||||||
new_ptr = unsafe { C.realloc(b, n) }
|
new_ptr = unsafe { C.realloc(b, n) }
|
||||||
if new_ptr == 0 {
|
if new_ptr == 0 {
|
||||||
|
|
Loading…
Reference in New Issue