diff options
author | Anthony PERARD <anthony.perard@citrix.com> | 2012-10-05 14:34:30 +0100 |
---|---|---|
committer | Anthony PERARD <anthony.perard@citrix.com> | 2012-10-05 14:34:30 +0100 |
commit | 5fe37ba9c6b6658ed7980f81f8374acd6e2f3bbd (patch) | |
tree | 74ef7377424cc78bfe25429e3a9c7b047a5cd3b7 /tools/libxl/libxl_pci.c | |
parent | 3c8ec17b26e686a6601e1a678c090f44464ad514 (diff) | |
download | xen-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_pci.c')
-rw-r--r-- | tools/libxl/libxl_pci.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index ff447e7102..eac35c10f2 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -73,12 +73,8 @@ int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl__device device; int ret = ERROR_NOMEM, i; - front = flexarray_make(16, 1); - if (!front) - goto out; - back = flexarray_make(16, 1); - if (!back) - goto out; + front = flexarray_make(gc, 16, 1); + back = flexarray_make(gc, 16, 1); ret = 0; @@ -108,11 +104,6 @@ int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, libxl__xs_kvs_of_flexarray(gc, back, back->count), libxl__xs_kvs_of_flexarray(gc, front, front->count)); -out: - if (back) - flexarray_free(back); - if (front) - flexarray_free(front); return 0; } @@ -138,9 +129,7 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d return ERROR_FAIL; } - back = flexarray_make(16, 1); - if (!back) - return ERROR_NOMEM; + back = flexarray_make(gc, 16, 1); LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Adding new pci device to xenstore"); num = atoi(num_devs); @@ -157,7 +146,6 @@ retry_transaction: if (errno == EAGAIN) goto retry_transaction; - flexarray_free(back); return 0; } |