admin: Use automatic mutex management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tim Wiederhake 2022-02-16 16:34:47 +01:00
parent df8992c277
commit 440a8d271d

View File

@ -165,9 +165,9 @@ adminDispatchConnectOpen(virNetServer *server G_GNUC_UNUSED,
struct daemonAdmClientPrivate *priv = struct daemonAdmClientPrivate *priv =
virNetServerClientGetPrivateData(client); virNetServerClientGetPrivateData(client);
int ret = -1; int ret = -1;
VIR_LOCK_GUARD lock = virLockGuardLock(&priv->lock);
VIR_DEBUG("priv=%p dmn=%p", priv, priv->dmn); VIR_DEBUG("priv=%p dmn=%p", priv, priv->dmn);
virMutexLock(&priv->lock);
flags = args->flags; flags = args->flags;
virCheckFlagsGoto(0, cleanup); virCheckFlagsGoto(0, cleanup);
@ -176,7 +176,6 @@ adminDispatchConnectOpen(virNetServer *server G_GNUC_UNUSED,
cleanup: cleanup:
if (ret < 0) if (ret < 0)
virNetMessageSaveError(rerr); virNetMessageSaveError(rerr);
virMutexUnlock(&priv->lock);
return ret; return ret;
} }