From 952d16ca58429d126224662f4f5f496a0535c7ac Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sat, 26 Oct 2024 20:33:45 -0400 Subject: Fix all low level il function getters leaking in rust --- rust/src/llil/function.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'rust/src/llil/function.rs') diff --git a/rust/src/llil/function.rs b/rust/src/llil/function.rs index 8f1eac62..abc501e5 100644 --- a/rust/src/llil/function.rs +++ b/rust/src/llil/function.rs @@ -84,10 +84,7 @@ where M: FunctionMutability, F: FunctionForm, { - pub(crate) unsafe fn from_raw( - borrower: A::Handle, - handle: *mut BNLowLevelILFunction, - ) -> Ref { + pub(crate) unsafe fn from_raw(borrower: A::Handle, handle: *mut BNLowLevelILFunction) -> Self { debug_assert!(!handle.is_null()); Self { @@ -97,7 +94,13 @@ where _mutability: PhantomData, _form: PhantomData, } - .to_owned() + } + + pub(crate) unsafe fn ref_from_raw( + borrower: A::Handle, + handle: *mut BNLowLevelILFunction, + ) -> Ref { + Ref::new(Self::from_raw(borrower, handle)) } pub(crate) fn arch(&self) -> &A { -- cgit v1.3.1