admin: Clean up error path in adminServerListClients

Coverity noted that in adminServerListClients if virNetServerGetClients
returns a -1 into ret, then the call virObjectListFreeCount in cleanup
will not be very happy.

Adjust the code to skip the cleanup label and just return -1 if
virNetServerGetClients fails.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2016-05-05 18:32:25 -04:00
parent 4fac5a9fd3
commit 70e9114e7c

View File

@ -191,14 +191,13 @@ adminServerListClients(virNetServerPtr srv,
virCheckFlags(0, -1);
if ((ret = virNetServerGetClients(srv, &clts)) < 0)
goto cleanup;
return -1;
if (clients) {
*clients = clts;
clts = NULL;
}
cleanup:
virObjectListFreeCount(clts, ret);
return ret;
}