Navigation Menu

Skip to content

Commit

Permalink
fix sized deallocation for OwnedSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Sep 6, 2014
1 parent d1bd139 commit 2fdad65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libsyntax/owned_slice.rs
Expand Up @@ -58,9 +58,12 @@ impl<T> OwnedSlice<T> {
if len == 0 {
OwnedSlice::empty()
} else {
// drop excess capacity to avoid breaking sized deallocation
v.shrink_to_fit();

let p = v.as_mut_ptr();
// we own the allocation now
unsafe {mem::forget(v)}
unsafe { mem::forget(v) }

OwnedSlice { data: p, len: len }
}
Expand Down

0 comments on commit 2fdad65

Please sign in to comment.