The function can't return NULL to the callers so it doesn't make sense
to check it.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/rpc/virnetsshsession.c | 31 ++++---------------------------
1 file changed, 4 insertions(+), 27 deletions(-)
diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index 73e65d9371..a3dd60f5a3 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -981,17 +981,11 @@ virNetSSHSessionAuthAddPasswordAuth(virNetSSHSession *sess,
}
}
- if (!(auth = virNetSSHSessionAuthMethodNew(sess)))
- goto error;
-
+ auth = virNetSSHSessionAuthMethodNew(sess);
auth->method = VIR_NET_SSH_AUTH_PASSWORD;
virObjectUnlock(sess);
return 0;
-
- error:
- virObjectUnlock(sess);
- return -1;
}
int
@@ -1001,17 +995,11 @@ virNetSSHSessionAuthAddAgentAuth(virNetSSHSession *sess)
virObjectLock(sess);
- if (!(auth = virNetSSHSessionAuthMethodNew(sess)))
- goto error;
-
+ auth = virNetSSHSessionAuthMethodNew(sess);
auth->method = VIR_NET_SSH_AUTH_AGENT;
virObjectUnlock(sess);
return 0;
-
- error:
- virObjectUnlock(sess);
- return -1;
}
int
@@ -1028,11 +1016,7 @@ virNetSSHSessionAuthAddPrivKeyAuth(virNetSSHSession *sess,
virObjectLock(sess);
- if (!(auth = virNetSSHSessionAuthMethodNew(sess))) {
- virObjectUnlock(sess);
- return -1;
- }
-
+ auth = virNetSSHSessionAuthMethodNew(sess);
auth->filename = g_strdup(keyfile);
auth->method = VIR_NET_SSH_AUTH_PRIVKEY;
@@ -1048,19 +1032,12 @@ virNetSSHSessionAuthAddKeyboardAuth(virNetSSHSession *sess,
virObjectLock(sess);
- if (!(auth = virNetSSHSessionAuthMethodNew(sess)))
- goto error;
-
+ auth = virNetSSHSessionAuthMethodNew(sess);
auth->tries = tries;
auth->method = VIR_NET_SSH_AUTH_KEYBOARD_INTERACTIVE;
virObjectUnlock(sess);
return 0;
-
- error:
- virObjectUnlock(sess);
- return -1;
-
}
void
--
2.38.1