SSH credential crash

See #1700.

I was wondering about the direct `return -1` while the rest uses `goto on_error` so I changed it.