summaryrefslogtreecommitdiff
path: root/rust/src/high_level_il/function.rs
diff options
context:
space:
mode:
authorMark Rowe <mrowe@bdash.net.nz>2025-05-03 22:39:50 -0700
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-04 21:20:00 -0400
commit9bd1a1c5d54f46e250274538e8faee23d5520a88 (patch)
tree26965ce9020f5064941ddf4c3b18df68d16633e0 /rust/src/high_level_il/function.rs
parentc9253993ee4085880468cf9345519f45adfa77a3 (diff)
[Rust] Avoid leaking a reference within {Medium,High}LevelILFunction::ssa_form
Return a Ref<_> so that the underlying core object will have its reference count decremented when the caller drops the object.
Diffstat (limited to 'rust/src/high_level_il/function.rs')
-rw-r--r--rust/src/high_level_il/function.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/rust/src/high_level_il/function.rs b/rust/src/high_level_il/function.rs
index aad16e14..0813ad04 100644
--- a/rust/src/high_level_il/function.rs
+++ b/rust/src/high_level_il/function.rs
@@ -69,13 +69,10 @@ impl HighLevelILFunction {
unsafe { BNGetHighLevelILExprCount(self.handle) }
}
- pub fn ssa_form(&self) -> HighLevelILFunction {
+ pub fn ssa_form(&self) -> Ref<HighLevelILFunction> {
let ssa = unsafe { BNGetHighLevelILSSAForm(self.handle) };
assert!(!ssa.is_null());
- HighLevelILFunction {
- handle: ssa,
- full_ast: self.full_ast,
- }
+ unsafe { HighLevelILFunction::ref_from_raw(ssa, self.full_ast) }
}
pub fn function(&self) -> Ref<Function> {