Fix a memory leak in map.