purpleprotocol / mimalloc_rust

A Rust wrapper over Microsoft's MiMalloc memory allocator
MIT License
486 stars 42 forks source link

Don't return a c_void by value from mi_free #29

Closed thomcc closed 3 years ago

thomcc commented 4 years ago

This was undefined behavior since the signature was wrong, but in practice it's probably fine, unless someone actually uses the c_void.

At least, on ABIs I'm familiar with that's true, and it's hard to imagine ones where a u8 (what c_void boils down to) isn't returned by register.

Also it was unsafe to call this, anyway -- so callers doing that could be assumed to know better than to use the returned c_void for anything.

Fixes #26