[libvirt] [PATCH] virBufferVSprintf: do not skip va_end

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

 



This fixes the last of the varargs problems reported by coverity:

va_end(argptr) was never called, and va_end(locarg) would have
been skipped upon OOM.

>From 7a75b9da0d08a54e9f256dd26cca061b59c32c6d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Thu, 18 Feb 2010 21:25:01 +0100
Subject: [PATCH] virBufferVSprintf: do not skip va_end

* src/util/buf.c (virBufferVSprintf): Do not omit or skip va_end calls.
---
 src/util/buf.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/util/buf.c b/src/util/buf.c
index cc0a087..caf8ee0 100644
--- a/src/util/buf.c
+++ b/src/util/buf.c
@@ -246,14 +246,17 @@ virBufferVSprintf(const virBufferPtr buf, const char *format, ...)

         grow_size = (count > 1000) ? count : 1000;
         if (virBufferGrow(buf, grow_size) < 0)
-            return;
+            goto cleanup;

         size = buf->size - buf->use - 1;
         va_copy(locarg, argptr);
     }
-    va_end(locarg);
     buf->use += count;
     buf->content[buf->use] = '\0';
+
+ cleanup:
+    va_end(argptr);
+    va_end(locarg);
 }

 /**
--
1.7.0.233.g05e1a

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]