debuggers.hg

changeset 20819:dda8dc485d67

libxenlight: returns errors if xc and/or xs has not been initialized properly.

fixed segfault when xenstore or xc are not available.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jan 08 11:45:34 2010 +0000 (2010-01-08)
parents 5254234fdb71
children 819c21064517
files tools/libxl/libxl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Fri Jan 08 11:44:58 2010 +0000
     1.2 +++ b/tools/libxl/libxl.c	Fri Jan 08 11:45:34 2010 +0000
     1.3 @@ -45,7 +45,17 @@ int libxl_ctx_init(struct libxl_ctx *ctx
     1.4          return ERROR_NOMEM;
     1.5  
     1.6      ctx->xch = xc_interface_open();
     1.7 +    if (ctx->xch == -1) {
     1.8 +        free(ctx->alloc_ptrs);
     1.9 +        return ERROR_FAIL;
    1.10 +    }
    1.11 +
    1.12      ctx->xsh = xs_daemon_open();
    1.13 +    if (!ctx->xsh) {
    1.14 +        xc_interface_close(ctx->xch);
    1.15 +        free(ctx->alloc_ptrs);
    1.16 +        return ERROR_FAIL;
    1.17 +    }
    1.18      return 0;
    1.19  }
    1.20