diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-01-08 11:45:34 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-01-08 11:45:34 +0000 |
commit | 59d9a14fc638469ed1803004108bcd9085c46e5b (patch) | |
tree | 803a3577a3045729df51a67ee218c1cb7a37a7cf | |
parent | aa73db2addd9b9f6c23e490eebd5dd6d650a72c3 (diff) | |
download | xen-59d9a14fc638469ed1803004108bcd9085c46e5b.tar.gz xen-59d9a14fc638469ed1803004108bcd9085c46e5b.tar.bz2 xen-59d9a14fc638469ed1803004108bcd9085c46e5b.zip |
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>
-rw-r--r-- | tools/libxl/libxl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 8194623bf6..a49371540c 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -45,7 +45,17 @@ int libxl_ctx_init(struct libxl_ctx *ctx, int version) return ERROR_NOMEM; ctx->xch = xc_interface_open(); + if (ctx->xch == -1) { + free(ctx->alloc_ptrs); + return ERROR_FAIL; + } + ctx->xsh = xs_daemon_open(); + if (!ctx->xsh) { + xc_interface_close(ctx->xch); + free(ctx->alloc_ptrs); + return ERROR_FAIL; + } return 0; } |