fix: dealloc calls on zero pointers
This commit is contained in:
parent
5921b36a75
commit
67a5dbdd93
3 changed files with 12 additions and 6 deletions
|
|
@ -107,7 +107,9 @@ unsafe extern "C" fn ts_record_calloc(count: usize, size: usize) -> *mut c_void
|
|||
}
|
||||
|
||||
unsafe extern "C" fn ts_record_realloc(ptr: *mut c_void, size: usize) -> *mut c_void {
|
||||
record_dealloc(ptr);
|
||||
if !ptr.is_null() {
|
||||
record_dealloc(ptr);
|
||||
}
|
||||
let result = realloc(ptr, size);
|
||||
record_alloc(result);
|
||||
result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue