Fixed CTerrain-related memory leaks