aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_dm.c
diff options
context:
space:
mode:
authorAnthony PERARD <anthony.perard@citrix.com>2012-10-05 14:34:30 +0100
committerAnthony PERARD <anthony.perard@citrix.com>2012-10-05 14:34:30 +0100
commit5fe37ba9c6b6658ed7980f81f8374acd6e2f3bbd (patch)
tree74ef7377424cc78bfe25429e3a9c7b047a5cd3b7 /tools/libxl/libxl_dm.c
parent3c8ec17b26e686a6601e1a678c090f44464ad514 (diff)
downloadxen-5fe37ba9c6b6658ed7980f81f8374acd6e2f3bbd.tar.gz
xen-5fe37ba9c6b6658ed7980f81f8374acd6e2f3bbd.tar.bz2
xen-5fe37ba9c6b6658ed7980f81f8374acd6e2f3bbd.zip
libxl: Have flexarray using the GC
This patch makes the flexarray function libxl__gc aware. It also updates every function that use a flexarray to pass the gc and removes every memory allocation check and free. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_dm.c')
-rw-r--r--tools/libxl/libxl_dm.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 62c995432a..054da3ed1b 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -109,10 +109,7 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
const char *keymap = dm_keymap(guest_config);
int i;
flexarray_t *dm_args;
- dm_args = flexarray_make(16, 1);
-
- if (!dm_args)
- return NULL;
+ dm_args = flexarray_make(gc, 16, 1);
flexarray_vappend(dm_args, dm,
"-d", libxl__sprintf(gc, "%d", domid), NULL);
@@ -340,9 +337,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
int i;
uint64_t ram_size;
- dm_args = flexarray_make(16, 1);
- if (!dm_args)
- return NULL;
+ dm_args = flexarray_make(gc, 16, 1);
flexarray_vappend(dm_args, dm,
"-xen-domid",
@@ -837,7 +832,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
"setting target domain %d -> %d",
dm_domid, guest_domid);
ret = ERROR_FAIL;
- goto out_free;
+ goto out;
}
xs_set_target(ctx->xsh, dm_domid, guest_domid);
@@ -861,11 +856,8 @@ retry_transaction:
libxl__add_disks(egc, ao, dm_domid, dm_config, &sdss->multidev);
libxl__multidev_prepared(egc, &sdss->multidev, 0);
- free(args);
return;
-out_free:
- free(args);
out:
assert(ret);
spawn_stubdom_pvqemu_cb(egc, &sdss->pvqemu, ret);
@@ -1165,7 +1157,6 @@ retry_transaction:
out_close:
close(null);
close(logfile_w);
- free(args);
out:
if (rc)
device_model_spawn_outcome(egc, dmss, rc);