diff options
| author | Mason Reed <mason@vector35.com> | 2025-03-10 19:19:40 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-03-10 19:20:00 -0400 |
| commit | 8360abddc133e5a33945d0f63dbd8ea7d48562f3 (patch) | |
| tree | 68306431f30b26446c91d033bee343ef1bd6f33e /rust/src | |
| parent | a9a002c520866f0c63fa33f52ba244213aa479ff (diff) | |
Add missing nullptr check for `cb_free_type_list` in Rust API
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/architecture.rs | 9 |
1 files changed, 6 insertions, 3 deletions
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<Handle = CustomArchitectureHandle<A>> + 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::<Ref<Type>>::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::<Ref<Type>>::free_raw(ty); + } } } |
