Skip to content

Commit 5f31ef4

Browse files
use malloc and free with trackers
1 parent 14893de commit 5f31ef4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/metadata/libfunc_counter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ pub mod libfunc_counter_runtime {
230230
use crate::{
231231
error::Result,
232232
metadata::{libfunc_counter::LibfuncCounterMeta, MetadataStorage},
233-
utils::libc_malloc,
233+
utils::{libc_free, libc_malloc},
234234
};
235235

236236
/// Contains an array of vector for each execution completed.
@@ -287,7 +287,7 @@ pub mod libfunc_counter_runtime {
287287
}
288288

289289
pub extern "C" fn get_counters_array() -> *mut u32 {
290-
COUNTERS_ARRAY.with(|x| x.get()) as *mut u32
290+
COUNTERS_ARRAY.with(|x| x.get())
291291
}
292292

293293
/// Converts the pointer to the counters into a Rust `Vec` and store it. Then, it frees the pointer.
@@ -302,6 +302,6 @@ pub mod libfunc_counter_runtime {
302302
.unwrap()
303303
.insert(*counter_id_ptr, counters_vec);
304304

305-
libc::free(counter_array_ptr as *mut libc::c_void);
305+
libc_free(counter_array_ptr as *mut libc::c_void);
306306
}
307307
}

0 commit comments

Comments
 (0)