Consider using an std::vector here, as its far less error prone than manually managing memory.