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

[libvirt] [PATCH 7/8] vmware: avoid null deref on failed lookup



Detected by Coverity.

* src/vmware/vmware_driver.c (vmwareDomainReboot): Check error
before dereferencing memory.
---
 src/vmware/vmware_driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 5e2c4ba..52582d6 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -461,7 +461,6 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
     vmwareDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     vmwareDriverUnlock(driver);
-    vmxPath = ((vmwareDomainPtr) vm->privateData)->vmxPath;

     if (!vm) {
         vmwareError(VIR_ERR_NO_DOMAIN, "%s",
@@ -469,6 +468,7 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
         goto cleanup;
     }

+    vmxPath = ((vmwareDomainPtr) vm->privateData)->vmxPath;
     vmwareSetSentinal(cmd, vmw_types[driver->type]);
     vmwareSetSentinal(cmd, vmxPath);

-- 
1.7.4.4


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