提交 0f04b587 编写于 作者: M Matthias Bolte

opennebula: Fix potential memory/mutex leak in state driver startup

In case of an error the domains hash and the driver mutex may leak.

* src/opennebula/one_driver.c: free/destroy domains hash and driver
  mutex in error cases
上级 5469686b
......@@ -617,23 +617,26 @@ static int oneStartup(int privileged ATTRIBUTE_UNUSED){
return -1;
}
c_oneStart();
oneDriverLock(one_driver);
if (virDomainObjListInit(&one_driver->domains) < 0) {
virMutexDestroy(&one_driver->lock);
VIR_FREE(one_driver);
return -1;
goto error;
}
c_oneStart();
oneDriverLock(one_driver);
one_driver->nextid=1;
if ((one_driver->caps = oneCapsInit()) == NULL) {
oneDriverUnlock(one_driver);
VIR_FREE(one_driver);
return -1;
virReportOOMError(NULL);
goto error;
}
oneDriverUnlock(one_driver);
return 0;
error:
oneDriverUnlock(one_driver);
oneShutdown();
return -1;
}
static int oneShutdown(void){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册