]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix LXC driver crash when kernel doesn't support clone
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 12 Aug 2009 10:07:41 +0000 (11:07 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 17 Aug 2009 15:20:57 +0000 (16:20 +0100)
* src/domain_conf.c: Make virDomainObjListFree a no-op if list
  is NULL
* src/domain_event.c: make virDomainEventCallbackListFree a no-op
  if event list is NULL
* src/lxc_driver.c: Log a message if LXC driver does not startup
  due to lacking kernel support

src/domain_conf.c
src/domain_event.c
src/lxc_driver.c

index bad53f73fd45829772f185adbe45bd5cbc5b97cf..1d2cc7c6f58195fd1c38b0b925c6acf442bd479c 100644 (file)
@@ -532,6 +532,9 @@ void virDomainObjListFree(virDomainObjListPtr vms)
 {
     unsigned int i;
 
+    if (!vms)
+        return;
+
     for (i = 0 ; i < vms->count ; i++)
         virDomainObjFree(vms->objs[i]);
 
index daa6fd5f8edcec1593a5a7cfc2a810d5d140e4b6..0fa2822d16829a6313ec18416de5dc78f74b8c3a 100644 (file)
@@ -38,6 +38,9 @@ void
 virDomainEventCallbackListFree(virDomainEventCallbackListPtr list)
 {
     int i;
+    if (!list)
+        return;
+
     for (i=0; i<list->count; i++) {
         virFreeCallback freecb = list->callbacks[i]->freecb;
         if (freecb)
index a9c4f79ca8ebc39ba8a63ef59aaca4fbcb0649e5..bd0cf0ee1cd9404221b7f843df5c9cc5bd493f59 100644 (file)
@@ -1439,10 +1439,12 @@ static int lxcStartup(int privileged)
     lxcDriverLock(lxc_driver);
 
     /* Check that this is a container enabled kernel */
-    if(lxcContainerAvailable(0) < 0)
+    if (lxcContainerAvailable(0) < 0) {
+        VIR_INFO0("LXC support not available in this kernel, disabling driver");
         goto cleanup;
+    }
 
-    if(VIR_ALLOC(lxc_driver->domainEventCallbacks) < 0)
+    if (VIR_ALLOC(lxc_driver->domainEventCallbacks) < 0)
         goto cleanup;
     if (!(lxc_driver->domainEventQueue = virDomainEventQueueNew()))
         goto cleanup;