Explicit cast of malloc to satisfy -Wc++-compat