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

Re: [libvirt] [PATCH] virBufferStrcat: do not skip va_end



On Thu, Feb 18, 2010 at 08:51:59PM +0100, Jim Meyering wrote:
> Another missed va_end:
> 
> >From b2e727f9dd25f427d634ef4d79733b37af2b29dd Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Thu, 18 Feb 2010 20:46:24 +0100
> Subject: [PATCH] virBufferStrcat: do not skip va_end
> 
> * src/util/buf.c (virBufferStrcat): Do not skip va_end due to
> an early return.
> ---
>  src/util/buf.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/buf.c b/src/util/buf.c
> index e683928..cc0a087 100644
> --- a/src/util/buf.c
> +++ b/src/util/buf.c
> @@ -1,21 +1,21 @@
>  /*
>   * buf.c: buffers for libvirt
>   *
> - * Copyright (C) 2005-2008 Red Hat, Inc.
> + * Copyright (C) 2005-2008, 2010 Red Hat, Inc.
>   *
>   * See COPYING.LIB for the License of this software
>   *
>   * Daniel Veillard <veillard redhat com>
>   */
> 
>  #include <config.h>
> 
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
>  #include <stdarg.h>
>  #include "c-ctype.h"
> 
>  #define __VIR_BUFFER_C__
> 
>  #include "buf.h"
> @@ -410,25 +410,25 @@ virBufferURIEncodeString (virBufferPtr buf, const char *str)
>  void
>  virBufferStrcat(virBufferPtr buf, ...)
>  {
>      va_list ap;
>      char *str;
> 
>      if (buf->error)
>          return;
> 
>      va_start(ap, buf);
> 
>      while ((str = va_arg(ap, char *)) != NULL) {
>          unsigned int len = strlen(str);
>          unsigned int needSize = buf->use + len + 2;
> 
>          if (needSize > buf->size) {
>              if (virBufferGrow(buf, needSize - buf->use) < 0)
> -                return;
> +                break;
>          }
>          memcpy(&buf->content[buf->use], str, len);
>          buf->use += len;
>          buf->content[buf->use] = 0;
>      }
>      va_end(ap);
>  }

  Ah, right, 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]