mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
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
This commit is contained in:
parent
5469686bfd
commit
0f04b58730
@ -617,23 +617,26 @@ static int oneStartup(int privileged ATTRIBUTE_UNUSED){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainObjListInit(&one_driver->domains) < 0) {
|
||||
virMutexDestroy(&one_driver->lock);
|
||||
VIR_FREE(one_driver);
|
||||
return -1;
|
||||
}
|
||||
|
||||
c_oneStart();
|
||||
oneDriverLock(one_driver);
|
||||
|
||||
if (virDomainObjListInit(&one_driver->domains) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
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){
|
||||
|
Loading…
x
Reference in New Issue
Block a user