mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 13:16:56 +00:00
Stop panic propagation on malloc_stats_print() callback.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
bcc2be7661
commit
74f8cd3708
1 file changed
+6
@@ -117,6 +117,12 @@ pub fn memory_stats(opts: &str) -> Option<String> {
|
||||
}
|
||||
|
||||
unsafe extern "C" fn malloc_stats_cb(opaque: *mut c_void, msg: *const c_char) {
|
||||
catch_unwind(move || handle_malloc_stats(opaque, msg))
|
||||
.map_err(|_| abort())
|
||||
.ok();
|
||||
}
|
||||
|
||||
fn handle_malloc_stats(opaque: *mut c_void, msg: *const c_char) {
|
||||
// SAFETY: we have to trust the opaque points to our String
|
||||
let res: &mut String = unsafe {
|
||||
opaque
|
||||
|
||||
Reference in new issue
Block a user