Skip to content

Commit 4485163

Browse files
authored
Merge pull request #96 from MikailBag/master
Fix validity problem
2 parents 7a981e1 + da9e3fb commit 4485163

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
171171
if self.head.is_null() {
172172
// allocate the guard node if not present
173173
unsafe {
174-
self.head = Box::into_raw(Box::new(mem::uninitialized()));
174+
let node_layout = std::alloc::Layout::new::<Node<K, V>>();
175+
self.head = std::alloc::alloc(node_layout) as *mut Node<K, V>;
175176
(*self.head).next = self.head;
176177
(*self.head).prev = self.head;
177178
}

0 commit comments

Comments
 (0)