gssh: Aovid potential use-after-free
gssh: Aovid potential use-after-free

If we return an error, the app may unref the object, so we need to
emit state changes, and free any memory just before doing the task
return.

GNOME/hotssh,GNOME/hotssh