From 07360a0101d22eca2642717af5587549d56f6ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 28 Jul 2020 20:00:03 +0200 Subject: [PATCH] rpc: move lock after declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit virNetClientRemoveStream starts by calling a lock. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- src/rpc/virnetclient.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index d1fb564bbe..b064dab448 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1045,8 +1045,10 @@ int virNetClientAddStream(virNetClientPtr client, void virNetClientRemoveStream(virNetClientPtr client, virNetClientStreamPtr st) { - virObjectLock(client); size_t i; + + virObjectLock(client); + for (i = 0; i < client->nstreams; i++) { if (client->streams[i] == st) break;