Skip to content

Commit

Permalink
fix: drop inited field when clear
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx committed Apr 3, 2024
1 parent 7a9a7c8 commit f76da99
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/common/src/lru.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,16 @@ where

for ptr in map.drain() {
self.detach(ptr);
let _ = Box::from_raw_in(ptr.as_ptr(), self.alloc.clone());
let mut entry = Box::from_raw_in(ptr.as_ptr(), self.alloc.clone());
entry.key.assume_init_drop();
entry.value.assume_init_drop();
}

debug_assert!(self.is_empty());
debug_assert_eq!(
self.dummy.as_mut() as *mut _,
self.dummy.next.unwrap_unchecked().as_ptr()
)
}
}

Expand Down

0 comments on commit f76da99

Please sign in to comment.