From 4108964609171327618627477163339656037111 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Mon, 20 Feb 2023 21:58:55 -0500 Subject: Type Containers --- rust/src/types.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'rust/src') diff --git a/rust/src/types.rs b/rust/src/types.rs index 17bf96ae..5c568142 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -29,6 +29,7 @@ use crate::{ }; use lazy_static::lazy_static; +use std::ptr::null_mut; use std::{ borrow::Cow, collections::HashSet, @@ -1227,10 +1228,11 @@ impl fmt::Debug for Type { if let Ok(lock) = TYPE_DEBUG_BV.lock() { if let Some(bv) = &*lock { let mut count: usize = 0; + let container = unsafe { BNGetAnalysisTypeContainer(bv.handle) }; let lines: *mut BNTypeDefinitionLine = unsafe { BNGetTypeLines( self.handle, - bv.handle, + container, "".as_ptr() as *const c_char, 80, false, @@ -1238,6 +1240,9 @@ impl fmt::Debug for Type { &mut count as *mut usize, ) }; + unsafe { + BNFreeTypeContainer(container); + } if lines.is_null() { return Err(fmt::Error); @@ -2364,7 +2369,7 @@ impl CoreArrayProvider for QualifiedNameAndType { } unsafe impl CoreOwnedArrayProvider for QualifiedNameAndType { unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { - BNFreeTypeList(raw, count); + BNFreeTypeAndNameList(raw, count); } } -- cgit v1.3.1