diff --git a/src/lib.rs b/src/lib.rs index 9e6c7bd..0b4df88 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -244,13 +244,13 @@ impl Drop for Buffer { // since this is the destructor, there shouldn't be any contention... so meh? while let Some(_) = self.try_pop() {} - unsafe { + let layout = Layout::from_size_align( self.allocated_size * mem::size_of::(), mem::align_of::(), ).unwrap(); - alloc::dealloc(self.buffer as *mut u8, layout); - } + unsafe { alloc::dealloc(self.buffer as *mut u8, layout) }; + } }