Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/node_device/node_device_driver.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 130c1d4023..1eb452b989 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -1072,14 +1072,10 @@ static bool matchDeviceAddress(virNodeDeviceObj *obj, const void *opaque) { - g_autofree char *addr = NULL; - bool want = false; - - virObjectLock(obj); - addr = nodeDeviceObjFormatAddress(obj); - want = STREQ_NULLABLE(addr, opaque); - virObjectUnlock(obj); - return want; + VIR_LOCK_GUARD lock = virObjectLockGuard(obj); + g_autofree char *addr = nodeDeviceObjFormatAddress(obj); + + return STREQ_NULLABLE(addr, opaque); } -- 2.31.1