]> xenbits.xensource.com Git - libvirt.git/commitdiff
virBufferVSprintf: do not omit va_end(argptr) call
authorJim Meyering <meyering@redhat.com>
Thu, 18 Feb 2010 20:25:01 +0000 (21:25 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 19 Feb 2010 17:32:23 +0000 (18:32 +0100)
* src/util/buf.c (virBufferVSprintf): Do not omit va_end(argptr).
Improved-by: Daniel Veillard.
src/util/buf.c

index cc0a0870e334f3d3a48240bdd4e85b5f316acbec..fc1217bf608c60390eee503499d0cc70e6e9680b 100644 (file)
@@ -245,12 +245,15 @@ virBufferVSprintf(const virBufferPtr buf, const char *format, ...)
         va_end(locarg);
 
         grow_size = (count > 1000) ? count : 1000;
-        if (virBufferGrow(buf, grow_size) < 0)
+        if (virBufferGrow(buf, grow_size) < 0) {
+            va_end(argptr);
             return;
+        }
 
         size = buf->size - buf->use - 1;
         va_copy(locarg, argptr);
     }
+    va_end(argptr);
     va_end(locarg);
     buf->use += count;
     buf->content[buf->use] = '\0';