Skip to content

Commit

Permalink
fragment pool: improve IndexedDeque::pop_back safety
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-babichenko committed Apr 7, 2021
1 parent 6e74df4 commit 75ee37c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jormungandr/src/fragment/pool.rs
Expand Up @@ -251,13 +251,13 @@ pub(super) mod internal {

fn pop_back(&mut self) -> Option<(K, V)> {
let tail = unsafe { self.tail.as_mut() }?;
let entry = self.index.remove(&IndexedDequeueKeyRef(&tail.key)).unwrap();
self.tail = tail.prev;
if let Some(prev) = unsafe { tail.prev.as_mut() } {
prev.next = ptr::null_mut();
} else {
self.head = ptr::null_mut();
}
let entry = self.index.remove(&IndexedDequeueKeyRef(&tail.key)).unwrap();
Some((entry.key, entry.value))
}

Expand Down

0 comments on commit 75ee37c

Please sign in to comment.