diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 1ecf35640c..108ae0aeb1 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -138,17 +138,6 @@ virStorageVolObjNew(void) } -static void -virStorageVolObjEndAPI(virStorageVolObj **obj) -{ - if (!*obj) - return; - - virObjectUnlock(*obj); - g_clear_pointer(obj, virObjectUnref); -} - - static void virStorageVolObjDispose(void *opaque) { @@ -660,7 +649,8 @@ virStoragePoolObjAddVol(virStoragePoolObj *obj, volobj->voldef = voldef; - virStorageVolObjEndAPI(&volobj); + virObjectUnlock(volobj); + virObjectUnref(volobj); virObjectRWUnlock(volumes); return 0; } @@ -689,8 +679,8 @@ virStoragePoolObjRemoveVol(virStoragePoolObj *obj, g_hash_table_remove(volumes->objsKey, voldef->key); g_hash_table_remove(volumes->objsName, voldef->name); g_hash_table_remove(volumes->objsPath, voldef->target.path); - virStorageVolObjEndAPI(&volobj); - + virObjectUnlock(volobj); + virObjectUnref(volobj); virObjectRWUnlock(volumes); }