Skip to content

Commit 47ef9cd

Browse files
committed
Fix Rust LinearDisassemblyLine not freeing properly
1 parent bd80e64 commit 47ef9cd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rust/src/linear_view.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,12 @@ impl LinearDisassemblyLine {
469469
}
470470

471471
pub(crate) fn free_raw(value: BNLinearDisassemblyLine) {
472-
let _ = unsafe { Function::ref_from_raw(value.function) };
472+
if !value.function.is_null() {
473+
let _ = unsafe { Function::ref_from_raw(value.function) };
474+
}
475+
if !value.block.is_null() {
476+
let _ = unsafe { BasicBlock::ref_from_raw(value.block, NativeBlock::new()) };
477+
}
473478
DisassemblyTextLine::free_raw(value.contents);
474479
}
475480
}

0 commit comments

Comments
 (0)