'list' will always be NULL when reaching 'virObjectListFreeCount' thus we can remove the call as well as the 'ret' variable which was only ever equal to 'nclients' at the point when we returned the value. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/rpc/virnetserver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index bb1a96b65e..b3214883ee 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -1077,7 +1077,6 @@ int virNetServerGetClients(virNetServer *srv, virNetServerClient ***clts) { - int ret = -1; size_t i; size_t nclients = 0; virNetServerClient **list = NULL; @@ -1090,11 +1089,10 @@ virNetServerGetClients(virNetServer *srv, } *clts = g_steal_pointer(&list); - ret = nclients; - virObjectListFreeCount(list, nclients); virObjectUnlock(srv); - return ret; + + return nclients; } virNetServerClient * -- 2.31.1