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

[libvirt] [PATCH] virBufferVSprintf: do not omit va_end(argptr) call



Just realized I didn't post a version of this without
the gnulib diff that Eric pointed out, so here you go:

>From 4501145dd3529dc510e6cb52025a71dd0b111b4d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Thu, 18 Feb 2010 21:25:01 +0100
Subject: [PATCH] virBufferVSprintf: do not omit va_end(argptr) call

* src/util/buf.c (virBufferVSprintf): Do not omit va_end(argptr).
Improved-by: Daniel Veillard.
---
 src/util/buf.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/util/buf.c b/src/util/buf.c
index cc0a087..fc1217b 100644
--- a/src/util/buf.c
+++ b/src/util/buf.c
@@ -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';
--
1.7.0.233.g05e1a


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