From 8360abddc133e5a33945d0f63dbd8ea7d48562f3 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 10 Mar 2025 19:19:40 -0400 Subject: Add missing nullptr check for `cb_free_type_list` in Rust API --- rust/src/architecture.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'rust/src') diff --git a/rust/src/architecture.rs b/rust/src/architecture.rs index 997089f8..41395e0d 100644 --- a/rust/src/architecture.rs +++ b/rust/src/architecture.rs @@ -2954,9 +2954,12 @@ where A: 'static + Architecture> + Send + Sync, { let _custom_arch = unsafe { &*(ctxt as *mut A) }; - let boxed_types = unsafe { Box::from_raw(std::ptr::slice_from_raw_parts_mut(tl, count)) }; - for ty in boxed_types { - Conf::>::free_raw(ty); + if !tl.is_null() { + let boxed_types = + unsafe { Box::from_raw(std::ptr::slice_from_raw_parts_mut(tl, count)) }; + for ty in boxed_types { + Conf::>::free_raw(ty); + } } } -- cgit v1.3.1