Fix LXC driver crash when kernel doesn't support clone

* 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
This commit is contained in:
Daniel P. Berrange 2009-08-12 11:07:41 +01:00
parent 2d6a581960
commit e403f8d43e
3 changed files with 10 additions and 2 deletions

View 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]);

View 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)

View 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;