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

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



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 veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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