diff mbox

[v2,2/3] libxl: use libxl__read_xenstore_mandatory in vdispl function

Message ID 20170918135614.30868-3-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Sept. 18, 2017, 1:56 p.m. UTC
Coverity-ID: 1418097

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_vdispl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tools/libxl/libxl_vdispl.c b/tools/libxl/libxl_vdispl.c
index 5740c89fad..befc56bdeb 100644
--- a/tools/libxl/libxl_vdispl.c
+++ b/tools/libxl/libxl_vdispl.c
@@ -40,10 +40,14 @@  static int libxl__vdispl_from_xenstore(libxl__gc *gc, const char *libxl_path,
                                        libxl_devid devid,
                                        libxl_device_vdispl *vdispl)
 {
-    char *be_path;
+    const char *be_path;
+    int rc;
 
     vdispl->devid = devid;
-    be_path = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/backend", libxl_path));
+    rc = libxl__xs_read_mandatory(gc, XBT_NULL,
+                                  GCSPRINTF("%s/backend", libxl_path),
+                                  &be_path);
+    if (rc) return rc;
 
     return libxl__backendpath_parse_domid(gc, be_path, &vdispl->backend_domid);
 }