[libvirt] [PATCH 01/11] util: buffer: Tolerate NULL 'buf' in virBufferStrcat

Peter Krempa pkrempa at redhat.com
Thu Mar 22 18:31:38 UTC 2018


Most other buffer APIs tolerate the buffer being NULL.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virbuffer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 1a6bf122e0..3d6defb73a 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -883,6 +883,9 @@ virBufferStrcat(virBufferPtr buf, ...)
 {
     va_list ap;

+    if (!buf)
+        return;
+
     va_start(ap, buf);
     virBufferStrcatVArgs(buf, ap);
     va_end(ap);
-- 
2.16.2




More information about the libvir-list mailing list