Casts for [mc]alloc to fix compiler error with g++