Fixed memory leak in Terrain.