]> xenbits.xensource.com Git - libvirt.git/commitdiff
virNetLibsshSessionAuthAddPrivKeyAuth: Don't unlock unlocked 'sess' on error
authorPeter Krempa <pkrempa@redhat.com>
Tue, 2 Feb 2021 14:57:06 +0000 (15:57 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Feb 2021 12:07:12 +0000 (13:07 +0100)
The check whether @keyfile is non-NULL is before locking @sess, but uses
the 'error' label which unlocks '@sess'.

While touching the error path, update the error message to be on one
line.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/rpc/virnetlibsshsession.c

index 959a16a6a98fcbc252a98f913f6ddd8ab913912f..ed697c7ce417f2f2cd10d3a5575287be000ab996 100644 (file)
@@ -1020,10 +1020,8 @@ virNetLibsshSessionAuthAddPrivKeyAuth(virNetLibsshSessionPtr sess,
 
     if (!keyfile) {
         virReportError(VIR_ERR_LIBSSH, "%s",
-                       _("Key file path must be provided "
-                         "for private key authentication"));
-        ret = -1;
-        goto error;
+                       _("Key file path must be provided for private key authentication"));
+        return -1;
     }
 
     virObjectLock(sess);