libxl: do not call exit() in libxl_device_vtpm_list
authorMarek Marczykowski <marmarek@invisiblethingslab.com>
Wed, 8 May 2013 03:47:53 +0000 (05:47 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 4 Jul 2013 09:38:16 +0000 (10:38 +0100)
Signal error with NULL return value, do not terminate the whole process.

Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c

index 3236aa96a028ec3b4a0ba92528c3e47ad2dbd578..bd63a305d7e87b877996ac42a7c8f5d3def8508d 100644 (file)
@@ -1861,11 +1861,12 @@ libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, uint32_t domid, int *n
           vtpm->backend_domid = atoi(tmp);
 
           tmp = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/uuid", be_path));
-          if(tmp) {
-             if(libxl_uuid_from_string(&(vtpm->uuid), tmp)) {
-                LOG(ERROR, "%s/uuid is a malformed uuid?? (%s) Probably a bug!!\n", be_path, tmp);
-                exit(1);
-             }
+          if (tmp) {
+              if(libxl_uuid_from_string(&(vtpm->uuid), tmp)) {
+                  LOG(ERROR, "%s/uuid is a malformed uuid?? (%s) Probably a bug!!\n", be_path, tmp);
+                  free(vtpms);
+                  return NULL;
+              }
           }
        }
     }