Fix memory leak in avoid_crossing_perimeters. #1044