Memory allocating with new[] should be freed with delete[]