render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 5f74be7990f83f8a8d3fe71c440c4d0e3dbc4d27 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <5f74be7990f83f8a8d3fe71c440c4d0e3dbc4d27@dist-git>
9119d9
From: John Ferlan <jferlan@redhat.com>
9119d9
Date: Mon, 15 Sep 2014 15:13:50 -0400
9119d9
Subject: [PATCH] qemu: Resolve Coverity FORWARD_NULL
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1141209
9119d9
9119d9
If we jump to cleanup before allocating the 'result', then the call
9119d9
to virBlkioDeviceArrayClear will deref result causing a problem.
9119d9
9119d9
Signed-off-by: John Ferlan <jferlan@redhat.com>
9119d9
(cherry picked from commit f28a31fcc42ec82fc60e409afd7d2f2220ae9d2d)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_driver.c | 6 ++++--
9119d9
 1 file changed, 4 insertions(+), 2 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
9119d9
index 04384fb..3c7f2ba 100644
9119d9
--- a/src/qemu/qemu_driver.c
9119d9
+++ b/src/qemu/qemu_driver.c
9119d9
@@ -7688,8 +7688,10 @@ qemuDomainParseBlkioDeviceStr(char *blkioDeviceStr, const char *type,
9119d9
                    _("unable to parse blkio device '%s' '%s'"),
9119d9
                    type, blkioDeviceStr);
9119d9
  cleanup:
9119d9
-    virBlkioDeviceArrayClear(result, ndevices);
9119d9
-    VIR_FREE(result);
9119d9
+    if (result) {
9119d9
+        virBlkioDeviceArrayClear(result, ndevices);
9119d9
+        VIR_FREE(result);
9119d9
+    }
9119d9
     return -1;
9119d9
 }
9119d9
 
9119d9
-- 
9119d9
2.1.0
9119d9