Added error handling to check_dir and also cleaned up the allocated memory.
Added error handling to check_dir and also cleaned up the allocated memory.

globus/globus-toolkit,gridcf/gct,globus/globus-toolkit,globus/globus-toolkit,ellert/globus-toolkit,globus/globus-toolkit,ellert/globus-toolkit,globus/globus-toolkit,gridcf/gct,globus/globus-toolkit,ellert/globus-toolkit,ellert/globus-toolkit,globus/globus-toolkit,ellert/globus-toolkit,ellert/globus-toolkit,gridcf/gct,globus/globus-toolkit,ellert/globus-toolkit,gridcf/gct,gridcf/gct,gridcf/gct,ellert/globus-toolkit