[PATCH 4/7] tests: Don't call virNetServerClientClose without valid client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If @client hasn't been opened, then don't call virNetServerClientClose
since that'll cause certain failure.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 tests/virnetserverclienttest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/virnetserverclienttest.c b/tests/virnetserverclienttest.c
index 398b46928c..aa3f0bcf9b 100644
--- a/tests/virnetserverclienttest.c
+++ b/tests/virnetserverclienttest.c
@@ -152,7 +152,8 @@ static int testIdentity(const void *opaque ATTRIBUTE_UNUSED)
     ret = 0;
  cleanup:
     virObjectUnref(sock);
-    virNetServerClientClose(client);
+    if (!client)
+        virNetServerClientClose(client);
     virObjectUnref(client);
     virObjectUnref(ident);
     VIR_FORCE_CLOSE(sv[0]);
-- 
2.13.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux