From 806691fa172a1bc0250a34faa3868eb4ecd84dcd Mon Sep 17 00:00:00 2001 From: Steven Gu Date: Mon, 23 Oct 2023 09:42:07 +0800 Subject: [PATCH] U --- common/libzkp/impl/src/utils.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/libzkp/impl/src/utils.rs b/common/libzkp/impl/src/utils.rs index b06589a00c..206dd1ef08 100644 --- a/common/libzkp/impl/src/utils.rs +++ b/common/libzkp/impl/src/utils.rs @@ -13,8 +13,14 @@ pub(crate) static OUTPUT_DIR: Lazy> = /// # Safety #[no_mangle] -pub unsafe extern "C" fn free_c_chars(ptr: *mut c_char) { - let _ = CString::from_raw(ptr); +pub extern "C" fn free_c_chars(ptr: *mut c_char) { + log::info!("free_c_chars BEGIN"); + if !ptr.is_null() { + unsafe { + let _ = CString::from_raw(ptr); + } + } + log::info!("free_c_chars END"); } pub(crate) fn c_char_to_str(c: *const c_char) -> &'static str {