Use malloc instead of a variable-length array so that it will compile as ISO C++