Skip to content

Commit

Permalink
Merge pull request #96 from MikailBag/master
Browse files Browse the repository at this point in the history
Fix validity problem
  • Loading branch information
Gankra authored Aug 16, 2019
2 parents 7a981e1 + da9e3fb commit 4485163
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
if self.head.is_null() {
// allocate the guard node if not present
unsafe {
self.head = Box::into_raw(Box::new(mem::uninitialized()));
let node_layout = std::alloc::Layout::new::<Node<K, V>>();
self.head = std::alloc::alloc(node_layout) as *mut Node<K, V>;
(*self.head).next = self.head;
(*self.head).prev = self.head;
}
Expand Down

0 comments on commit 4485163

Please sign in to comment.