[libvirt] [PATCH 4/5] util: Avoid Coverity FORWARD_NULL

John Ferlan jferlan at redhat.com
Fri Sep 4 14:31:01 UTC 2015


Coverity claims it could be possible to call virDBusTypeStackFree with
*stack == NULL and although the two API's that call it don't appear to
allow that - I suppose it's better to be safe than sorry

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/util/virdbus.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index 1cf1eef..78fb795 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -544,6 +544,10 @@ static void virDBusTypeStackFree(virDBusTypeStack **stack,
                                  size_t *nstack)
 {
     size_t i;
+
+    if (!*stack)
+        return;
+
     /* The iter in the first level of the stack is the
      * root iter which must not be freed
      */
-- 
2.1.0




More information about the libvir-list mailing list