Re: [PATCH 3/3] qemu: Avoid the memory allocation and freeing

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

 



On Wed, Apr 11, 2012 at 10:40:34PM +0800, Osier Yang wrote:
> ---
>  src/qemu/qemu_process.c |   14 +++++---------
>  1 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 0bf743b..7a48c12 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -1759,23 +1759,19 @@ static char *
>  qemuGetNumadAdvice(virDomainDefPtr def)
>  {
>      virCommandPtr cmd = NULL;
> -    char *args = NULL;
>      char *output = NULL;
>  
> -    if (virAsprintf(&args, "%d:%llu", def->vcpus, def->mem.cur_balloon) < 0) {
> -        virReportOOMError();
> -        goto out;
> -    }
> -    cmd = virCommandNewArgList(NUMAD, "-w", args, NULL);
> +    cmd = virCommandNewArgList(NUMAD, "-w", NULL);
> +    virCommandAddArgFormat(cmd, "%d:%llu", def->vcpus,
> +                           def->mem.cur_balloon);
>  
>      virCommandSetOutputBuffer(cmd, &output);
>  
>      if (virCommandRun(cmd, NULL) < 0)
>          qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                        _("Failed to query numad for the advisory nodeset"));
> +                        _("Failed to query numad for the "
> +                          "advisory nodeset"));
>  
> -out:
> -    VIR_FREE(args);
>      virCommandFree(cmd);
>      return output;
>  }
> -- 
> 1.7.1

  ACK, that's a pure cleanup, should not change any functionality,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]