Changing a delete to delete[] which makes it correct.