[libvirt] [PATCH 01/10] command: avoid leak on failure

Daniel Veillard veillard at redhat.com
Fri Jun 3 00:26:09 UTC 2011


On Thu, Jun 02, 2011 at 05:07:53PM -0600, Eric Blake wrote:
> Detected by Coverity.  While it is possible on OOM condition, as
> well as with bad code that passes binary == NULL, it is unlikely
> to be encountered in the wild.
> 
> * src/util/command.c (virCommandNewArgList): Don't leak memory.
> ---
>  src/util/command.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/command.c b/src/util/command.c
> index 288958e..a2f7ff6 100644
> --- a/src/util/command.c
> +++ b/src/util/command.c
> @@ -142,7 +142,7 @@ virCommandNewArgList(const char *binary, ...)
>      const char *arg;
> 
>      if (!cmd || cmd->has_error)
> -        return NULL;
> +        return cmd;
> 
>      va_start(list, binary);
>      while ((arg = va_arg(list, const char *)) != NULL)

  ACK,

Daniel

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




More information about the libvir-list mailing list