Skip to content

Commit

Permalink
Add missing allocation guard in RawVec::grow
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDiekmann committed Apr 1, 2020
1 parent c49f280 commit 89ed59d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 89ed59d

Please sign in to comment.