]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: use the return value of virObjectRef directly
authorMarc Hartmayer <mhartmay@linux.ibm.com>
Thu, 14 Nov 2019 17:44:19 +0000 (18:44 +0100)
committerCole Robinson <crobinso@redhat.com>
Fri, 13 Dec 2019 19:37:00 +0000 (14:37 -0500)
Use the return value of virObjectRef directly. This way, it's easier
for another reader to identify the reason why the additional reference
is required.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/rpc/virnetserver.c

index 590e780b641eadd568f5c3368996877f5d548bad..673bb7c10c86dc782bf4014899c08ecc17516fb6 100644 (file)
@@ -199,7 +199,7 @@ virNetServerDispatchNewMessage(virNetServerClientPtr client,
         if (VIR_ALLOC(job) < 0)
             goto error;
 
-        job->client = client;
+        job->client = virObjectRef(client);
         job->msg = msg;
 
         if (prog) {
@@ -207,7 +207,6 @@ virNetServerDispatchNewMessage(virNetServerClientPtr client,
             priority = virNetServerProgramGetPriority(prog, msg->header.proc);
         }
 
-        virObjectRef(client);
         if (virThreadPoolSendJob(srv->workers, priority, job) < 0) {
             virObjectUnref(client);
             VIR_FREE(job);