]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
util: Avoid Coverity FORWARD_NULL
authorJohn Ferlan <jferlan@redhat.com>
Tue, 1 Sep 2015 11:02:30 +0000 (07:02 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 4 Sep 2015 19:19:04 +0000 (15:19 -0400)
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

src/util/virdbus.c

index 1cf1eef39ad84f8ec7760690b2a4770c238636c1..78fb7953dca2e6ae9716b95a516ddadf1e73f36b 100644 (file)
@@ -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
      */