Add missing allocation guard in `RawVec::grow`

This commit is contained in:
Tim Diekmann 2020-04-01 10:26:30 +02:00 committed by GitHub
parent c49f28005d
commit 89ed59d884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -520,6 +520,7 @@ impl<T, A: AllocRef> RawVec<T, A> {
Layout::array::<T>(cap).map_err(|_| CapacityOverflow)?
}
};
alloc_guard(new_layout.size())?;
let memory = if let Some((ptr, old_layout)) = self.current_memory() {
debug_assert_eq!(old_layout.align(), new_layout.align());