Gridmanager can crash on certain replies from the EC2 GAHP #3701

Add some more checks for NULL error string on EC2 GAHP command failure.
Also fix some memory leaks of those strings.