]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
libxl: Resolve Coverity FORWARD_NULL
authorJohn Ferlan <jferlan@redhat.com>
Thu, 24 Sep 2015 18:57:14 +0000 (14:57 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 7 Oct 2015 22:34:52 +0000 (18:34 -0400)
Since the strtok_r call in libxlCapsInitGuests expects a non NULL first
parameter when the third parameter is NULL, we need to check that
the returned 'capabilities' from a libxl_get_version_info call is
not NULL and error out if so since the code expects it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/libxl/libxl_conf.c

index 35fd495c509f1e9dcbc4c12f5c91e91e6c0d7a90..4eed5caf0ee39b16c648a10fd4f39872edb45199 100644 (file)
@@ -319,6 +319,12 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
         return -1;
     }
 
+    if (!ver_info->capabilities) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Failed to get capabilities from libxenlight"));
+        return -1;
+    }
+
     err = regcomp(&regex, XEN_CAP_REGEX, REG_EXTENDED);
     if (err != 0) {
         char error[100];