Closed
Description
A call to malloc(0)
may return a null pointer or it may return a unique pointer to an allocation. Rust cannot call malloc(0)
as then the check for null to determine if the allocation has failed will not work. I special-cased it to always return null for zero-size allocations to avoid this error case.
However, this has exposed a new issue. If the exchange allocator returns a null pointer, then the assumption of unique pointers being non-null does not hold. For example, Some(~())
is considered to be None
.
The only solution I can think of is clamping allocations to a minimum size of 1.
Metadata
Metadata
Assignees
Labels
No labels