[PATCH 9/9] ch_driver: Handle validation failure correctly

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

 



When validation like deviceValidateCallback fails, the vm will not be
set and so the call to virDomainObjListRemove will be passed a NULL
pointer causing a segfault. To prevent this add a check that the vm is
defined before calling out to virDomainObjListRemove.

Signed-off-by: William Douglas <william.douglas@xxxxxxxxx>
---
 src/ch/ch_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index c821459fc5..1824d2fd16 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -262,7 +262,7 @@ chDomainCreateXML(virConnectPtr conn,
     virCHDomainObjEndJob(vm);
 
  cleanup:
-    if (!dom) {
+    if (vm && !dom) {
         virDomainObjListRemove(driver->domains, vm);
     }
     virDomainDefFree(vmdef);
-- 
2.31.1




[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