Skip to content

Commit 142b4db

Browse files
committed
fix some uses of pointer intrinsics with invalid pointers
1 parent 83838ae commit 142b4db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

table.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,9 @@ impl<K, V> RawTable<K, V> {
742742
) -> Result<RawTable<K, V>, CollectionAllocErr> {
743743
unsafe {
744744
let ret = RawTable::new_uninitialized_internal(capacity, fallibility)?;
745-
ptr::write_bytes(ret.hashes.ptr(), 0, capacity);
745+
if capacity > 0 {
746+
ptr::write_bytes(ret.hashes.ptr(), 0, capacity);
747+
}
746748
Ok(ret)
747749
}
748750
}

0 commit comments

Comments
 (0)