Fix memory leak in gridmanager when issuing ec2 gahp commands. #3720