[libvirt] [PATCH 2/3] admin: Clean up error path in adminServerListClients

Erik Skultety eskultet at redhat.com
Sat May 7 14:18:53 UTC 2016


On 06/05/16 21:35, John Ferlan wrote:
> 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 at redhat.com>
> ---
>  daemon/admin_server.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/daemon/admin_server.c b/daemon/admin_server.c
> index 2fc4675..41f6e82 100644
> --- a/daemon/admin_server.c
> +++ b/daemon/admin_server.c
> @@ -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;
>  }
> 

ACK

Erik




More information about the libvir-list mailing list