Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj) combo the virNWFilterBindingObjEndAPI() can be used. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/virnwfilterbindingobjlist.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/conf/virnwfilterbindingobjlist.c b/src/conf/virnwfilterbindingobjlist.c index 470a30ca90..212cca2265 100644 --- a/src/conf/virnwfilterbindingobjlist.c +++ b/src/conf/virnwfilterbindingobjlist.c @@ -114,11 +114,8 @@ virNWFilterBindingObjListFindByPortDev(virNWFilterBindingObjList *bindings, obj = virNWFilterBindingObjListFindByPortDevLocked(bindings, name); virObjectRWUnlock(bindings); - if (obj && virNWFilterBindingObjGetRemoving(obj)) { - virObjectUnlock(obj); - virObjectUnref(obj); - obj = NULL; - } + if (obj && virNWFilterBindingObjGetRemoving(obj)) + virNWFilterBindingObjEndAPI(&obj); return obj; } @@ -407,8 +404,7 @@ virNWFilterBindingObjListFilter(virNWFilterBindingObj ***list, */ if (virNWFilterBindingObjGetRemoving(binding) || (filter && !filter(conn, def))) { - virObjectUnlock(binding); - virObjectUnref(binding); + virNWFilterBindingObjEndAPI(&binding); VIR_DELETE_ELEMENT(*list, i, *nbindings); continue; } -- 2.32.0