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

Re: [Xen-devel] [PATCH for-4.6 08/13] xl: call libxl_dominfo_init in main_list



On Thu, 2015-07-23 at 08:59 +0100, Wei Liu wrote:
> Also change the path that disposes of the buffer to use info_buf to
> avoid confusing coverity.
> 
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

But would it be less confusing to both human and machine readers if
info_buf was always init'd and dispose'd unconditionally at the head
and tail of the function? i.e. ignoring the fact that in one code path
we use a different info?


> ---
>  tools/libxl/xl_cmdimpl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index a4e56ef..79cef7a 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -4843,6 +4843,8 @@ int main_list(int argc, char **argv)
>          info_free = info;
>      } else if (optind == argc-1) {
>          uint32_t domid = find_domain(argv[optind]);
> +
> +        libxl_dominfo_init(&info_buf);
>          rc = libxl_domain_info(ctx, &info_buf, domid);
>          if (rc == ERROR_DOMAIN_NOTFOUND) {
>              fprintf(stderr, "Error: Domain \'%s\' does not 
> exist.\n",
> @@ -4869,7 +4871,7 @@ int main_list(int argc, char **argv)
>      if (info_free)
>          libxl_dominfo_list_free(info, nb_domain);
>      else
> -        libxl_dominfo_dispose(info);
> +        libxl_dominfo_dispose(&info_buf);
>  
>      return 0;
>  }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.