From: Peter Krempa Date: Tue, 2 Feb 2021 14:57:06 +0000 (+0100) Subject: virNetLibsshSessionAuthAddPrivKeyAuth: Don't unlock unlocked 'sess' on error X-Git-Tag: v7.1.0-rc1~326 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34e522418f7fdd22b0a88fd5402c1d8d1bcb28b1;p=thirdparty%2Flibvirt.git virNetLibsshSessionAuthAddPrivKeyAuth: Don't unlock unlocked 'sess' on error 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 Reviewed-by: Daniel P. Berrangé --- diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index 959a16a6a9..ed697c7ce4 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -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);