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

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

 



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@xxxxxxxxxx>
---
 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

--
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]