fix memory leak in 'delete[] x, y' lines