Skip to content

Commit

Permalink
fix double-free with Array<InstructionTextToken>
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran committed May 22, 2024
1 parent 27bc08f commit a6d7f72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/src/disassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ impl Drop for InstructionTextToken {
impl CoreArrayProvider for InstructionTextToken {
type Raw = BNInstructionTextToken;
type Context = ();
type Wrapped<'a> = Self;
type Wrapped<'a> = &'a Self;
}
unsafe impl CoreArrayProviderInner for InstructionTextToken {
unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) {
BNFreeInstructionText(raw, count)
}
unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
Self(*raw)
core::mem::transmute(raw)
}
}

Expand Down

0 comments on commit a6d7f72

Please sign in to comment.