Skip to content

Commit

Permalink
Use LinkedListAllocator::lock instead of self.inner.lock()
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Jan 30, 2020
1 parent 0f74db4 commit 00fedc8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/allocator/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ unsafe impl GlobalAlloc for Locked<LinkedListAllocator> {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
// perform layout adjustments
let (size, align) = LinkedListAllocator::size_align(layout);
let mut allocator = self.inner.lock();
let mut allocator = self.lock();

if let Some((region, alloc_start)) = allocator.find_region(size, align) {
let alloc_end = alloc_start.checked_add(size).expect("overflow");
Expand All @@ -140,6 +140,6 @@ unsafe impl GlobalAlloc for Locked<LinkedListAllocator> {
// perform layout adjustments
let (size, _) = LinkedListAllocator::size_align(layout);

self.inner.lock().add_free_region(ptr as usize, size)
self.lock().add_free_region(ptr as usize, size)
}
}

0 comments on commit 00fedc8

Please sign in to comment.