diff --git a/src/bitmap.rs b/src/bitmap.rs index fff0fe6..4f47866 100644 --- a/src/bitmap.rs +++ b/src/bitmap.rs @@ -135,11 +135,13 @@ impl PageAllocator for BitmapPageAllocator { crate::is_aligned(pos, Self::PAGE_SIZE), "pos must be aligned to PAGE_SIZE" ); - - if self - .inner - .dealloc_contiguous((pos - self.base) / PAGE_SIZE, num_pages) - { + if match num_pages.cmp(&1) { + core::cmp::Ordering::Equal => self.inner.dealloc((pos - self.base) / PAGE_SIZE), + core::cmp::Ordering::Greater => self + .inner + .dealloc_contiguous((pos - self.base) / PAGE_SIZE, num_pages), + _ => false, + } { self.used_pages -= num_pages; } }