diff options
| author | Rubens Brandao <git@rubens.io> | 2024-05-27 10:24:28 -0300 |
|---|---|---|
| committer | Kyle Martin <krm504@nyu.edu> | 2024-05-28 19:06:10 -0400 |
| commit | b3cc03be361d5c6253141e729b096e87e025490f (patch) | |
| tree | 8f89f295033a085a5e86a992b58694cd76a5e3fc /rust/src/hlil/operation.rs | |
| parent | fce26815b400b5d3c0b67a46085ba8c9a61c1457 (diff) | |
fix multiple memory leaks related to CStr/BnString
Diffstat (limited to 'rust/src/hlil/operation.rs')
| -rw-r--r-- | rust/src/hlil/operation.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rust/src/hlil/operation.rs b/rust/src/hlil/operation.rs index ee0d437b..e762a74b 100644 --- a/rust/src/hlil/operation.rs +++ b/rust/src/hlil/operation.rs @@ -1,8 +1,10 @@ use binaryninjacore_sys::BNGetGotoLabelName; +use crate::architecture::CoreIntrinsic; use crate::function::Function; use crate::rc::Ref; -use crate::types::{ConstantData, ILIntrinsic, SSAVariable, Variable}; +use crate::string::BnString; +use crate::types::{ConstantData, SSAVariable, Variable}; use super::HighLevelILLiftedInstruction; @@ -13,10 +15,8 @@ pub struct GotoLabel { } impl GotoLabel { - pub fn name(&self) -> &str { - let raw_str = unsafe { BNGetGotoLabelName(self.function.handle, self.target) }; - let c_str = unsafe { core::ffi::CStr::from_ptr(raw_str) }; - c_str.to_str().unwrap() + pub fn name(&self) -> BnString { + unsafe { BnString::from_raw(BNGetGotoLabelName(self.function.handle, self.target)) } } } @@ -320,7 +320,7 @@ pub struct Intrinsic { } #[derive(Clone, Debug, PartialEq)] pub struct LiftedIntrinsic { - pub intrinsic: ILIntrinsic, + pub intrinsic: CoreIntrinsic, pub params: Vec<HighLevelILLiftedInstruction>, } @@ -335,7 +335,7 @@ pub struct IntrinsicSsa { } #[derive(Clone, Debug, PartialEq)] pub struct LiftedIntrinsicSsa { - pub intrinsic: ILIntrinsic, + pub intrinsic: CoreIntrinsic, pub params: Vec<HighLevelILLiftedInstruction>, pub dest_memory: u64, pub src_memory: u64, |
