node_device_udev: initialize libpciaccess after the driver lock

This will simplify cleanup.
This commit is contained in:
Ján Tomko 2016-06-03 12:20:41 +02:00
parent feb876660e
commit 5c88b34afa

View File

@ -1517,11 +1517,12 @@ static int nodeStateCleanup(void)
virMutexDestroy(&driver->lock); virMutexDestroy(&driver->lock);
VIR_FREE(driver); VIR_FREE(driver);
VIR_FREE(priv); VIR_FREE(priv);
udevPCITranslateDeinit();
} else { } else {
ret = -1; ret = -1;
} }
udevPCITranslateDeinit();
return ret; return ret;
} }
@ -1711,9 +1712,6 @@ static int nodeStateInitialize(bool privileged,
struct udev *udev = NULL; struct udev *udev = NULL;
int ret = -1; int ret = -1;
if (udevPCITranslateInit(privileged) < 0)
goto out;
if (VIR_ALLOC(priv) < 0) if (VIR_ALLOC(priv) < 0)
goto out; goto out;
@ -1734,6 +1732,11 @@ static int nodeStateInitialize(bool privileged,
nodeDeviceLock(); nodeDeviceLock();
if (udevPCITranslateInit(privileged) < 0) {
VIR_FREE(priv);
goto out_unlock;
}
/* /*
* http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/libudev-udev.html#udev-new * http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/libudev-udev.html#udev-new
* *