diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 1b882a261a..40e5fa35e2 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -466,10 +466,8 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host, privkey = g_strdup(privkeyPath); } else { homedir = virGetUserDirectory(); - if (homedir) { - if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0) - goto no_memory; - } + if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0) + goto no_memory; } if (!authMethods) { @@ -566,10 +564,8 @@ virNetClientPtr virNetClientNewLibssh(const char *host, privkey = g_strdup(privkeyPath); } else { homedir = virGetUserDirectory(); - if (homedir) { - if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0) - goto no_memory; - } + if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0) + goto no_memory; } if (!authMethods) { diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index ec9dd35c46..08944f6771 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -805,9 +805,6 @@ static int virNetTLSContextLocateCredentials(const char *pkipath, */ userdir = virGetUserDirectory(); - if (!userdir) - goto error; - user_pki_path = g_strdup_printf("%s/.pki/libvirt", userdir); VIR_DEBUG("Trying to find TLS user credentials in %s", user_pki_path); @@ -864,15 +861,6 @@ static int virNetTLSContextLocateCredentials(const char *pkipath, VIR_FREE(userdir); return 0; - - error: - VIR_FREE(*cacert); - VIR_FREE(*cacrl); - VIR_FREE(*key); - VIR_FREE(*cert); - VIR_FREE(user_pki_path); - VIR_FREE(userdir); - return -1; }