[libvirt] [PATCH 2/2] qemu: Check return status for virDomainGraphicsListenSetAddress

John Ferlan jferlan at redhat.com
Tue Feb 9 12:34:02 UTC 2016


Recent refactors in the vbox code to check the return status for the
function tipped Coverity's scales of justice for any functions that
do not check status - such as this one.

Add a check of the status, adjust the long line too.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_command.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7b5a36f..a0ff5d4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -13135,12 +13135,17 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
                                    _("cannot parse VNC port '%s'"), port);
                     goto error;
                 }
-                if (val[0] == '[')
-                    virDomainGraphicsListenSetAddress(vnc, 0,
-                                                      val+1, tmp-(val+1), true);
-                else
-                    virDomainGraphicsListenSetAddress(vnc, 0,
-                                                      val, tmp-val, true);
+                if (val[0] == '[') {
+                    if (virDomainGraphicsListenSetAddress(vnc, 0,
+                                                          val+1, tmp-(val+1),
+                                                          true) < 0)
+                        goto error;
+                } else {
+                    if (virDomainGraphicsListenSetAddress(vnc, 0,
+                                                          val, tmp-val,
+                                                          true) < 0)
+                        goto error;
+                }
                 if (!virDomainGraphicsListenGetAddress(vnc, 0))
                     goto error;
 
-- 
2.5.0




More information about the libvir-list mailing list