aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl
diff options
context:
space:
mode:
authorGianni Tedesco <gianni.tedesco@citrix.com>2010-08-17 17:23:25 +0100
committerGianni Tedesco <gianni.tedesco@citrix.com>2010-08-17 17:23:25 +0100
commit299ac6622b7c89db1de33627dd680862eacda394 (patch)
treebbe61e91cbbee7bbdbce8bee0407f0957e18ade6 /tools/libxl
parent8188bc8a37e790fd2f051c2714c2a628d10c1c5e (diff)
downloadxen-299ac6622b7c89db1de33627dd680862eacda394.tar.gz
xen-299ac6622b7c89db1de33627dd680862eacda394.tar.bz2
xen-299ac6622b7c89db1de33627dd680862eacda394.zip
tools/libxl: fix leak in libxl_wait_for_backend()
Another leak was been introduced since the gc patch-set. Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl')
-rw-r--r--tools/libxl/libxl_device.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 7a8c4fcbc4..1fc81ce316 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -457,6 +457,7 @@ int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
unsigned int len;
char *p;
char *path = libxl_sprintf(&gc, "%s/state", be_path);
+ int rc = -1;
while (watchdog > 0) {
p = xs_read(ctx->xsh, XBT_NULL, path, &len);
@@ -468,10 +469,11 @@ int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access backend %s",
be_path);
}
- return -1;
+ goto out;
} else {
if (!strcmp(p, state)) {
- return 0;
+ rc = 0;
+ goto out;
} else {
usleep(100000);
watchdog--;
@@ -479,7 +481,8 @@ int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
}
}
XL_LOG(ctx, XL_LOG_ERROR, "Backend %s not ready", be_path);
+out:
libxl_free_all(&gc);
- return -1;
+ return rc;
}