Skip to content

Commit

Permalink
fix double free caused by Array<InstructionTextToken>
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran committed Jun 4, 2024
1 parent a6d7f72 commit 5ae2db4
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 @@ -282,14 +282,14 @@ unsafe impl CoreArrayProviderInner for InstructionTextToken {
impl CoreArrayProvider for Array<InstructionTextToken> {
type Raw = BNInstructionTextLine;
type Context = ();
type Wrapped<'a> = Self;
type Wrapped<'a> = mem::ManuallyDrop<Self>;
}
unsafe impl CoreArrayProviderInner for Array<InstructionTextToken> {
unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) {
BNFreeInstructionTextLines(raw, count)
}
unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
Self::new(raw.tokens, raw.count, ())
mem::ManuallyDrop::new(Self::new(raw.tokens, raw.count, ()))
}
}

Expand Down

0 comments on commit 5ae2db4

Please sign in to comment.