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

[libvirt] [PATCH] vbox: Prevent from registering storage driver with NULL



Since 5892944fc853 the virRegisterStorageDriver may be called with
a NULL storageDriver if it failed on vboxGetStorageDriver.
So make sure the storageDriver is not NULL before register.

---
 src/vbox/vbox_driver.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index c64d2d6..b2e35e9 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -74,7 +74,7 @@ int vboxStorageRegister(void)
     if (VBoxCGlueInit(&uVersion) == 0)
         storageDriver = vboxGetStorageDriver(uVersion);
 
-    if (virRegisterStorageDriver(storageDriver) < 0)
+    if (storageDriver && virRegisterStorageDriver(storageDriver) < 0)
         return -1;
     return 0;
 }
-- 
1.7.9.5


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