Re: [libvirt] [PATCH] Minor cleanup of error path for c_oneVmInfo.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 07, 2009 at 11:06:19AM +0200, Chris Lalancette wrote:
> Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
> ---
>  src/opennebula/one_client.c |   16 ++++++----------
>  1 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/src/opennebula/one_client.c b/src/opennebula/one_client.c
> index d1641bf..21f303a 100644
> --- a/src/opennebula/one_client.c
> +++ b/src/opennebula/one_client.c
> @@ -176,6 +176,7 @@ int c_oneVmInfo(int vmid, char* ret_info,int length)
>      xmlrpc_value *resultP;
>      int return_code;
>      char *return_string;
> +    int retval = -1;
>  
>      resultP = xmlrpc_client_call(&one_client.env, one_client.url,
>          "one.vmget_info", "(si)", one_client.session, vmid);
> @@ -188,18 +189,13 @@ int c_oneVmInfo(int vmid, char* ret_info,int length)
>          strncpy(ret_info, return_string, length-1);
>          ret_info[length-1] = '\0';
>  
> -        xmlrpc_DECREF(resultP);
> -        free(return_string);
> -
> -        return 0;
> +        retval = 0;
>      }
> -    else
> -    {
> -        xmlrpc_DECREF(resultP);
> -        free(return_string);
>  
> -        return -1;
> -    }
> +    xmlrpc_DECREF(resultP);
> +    free(return_string);
> +
> +    return retval;
>  }
>  
>  void c_oneFree()

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]