diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2012-03-01 12:26:13 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2012-03-01 12:26:13 +0000 |
commit | 9dc5f1364dac38ab6c3e831a576d31e73c62426b (patch) | |
tree | 22f6c2a9cad8ad7e10ba6e301f0a311009731dac /tools/libxl/libxl_utils.c | |
parent | cad39d78f05280ce17b224df73b3fad4078e5a9d (diff) | |
download | xen-9dc5f1364dac38ab6c3e831a576d31e73c62426b.tar.gz xen-9dc5f1364dac38ab6c3e831a576d31e73c62426b.tar.bz2 xen-9dc5f1364dac38ab6c3e831a576d31e73c62426b.zip |
libxl: generate a _dispose function for all Aggregate types
Don't special case types which we happen to know do not contain allocated data
such that in the future if this changes we do not need to add an API. Although
there is likely to be latent bugs in callers due to this having the API in old
libraries mean that when callers are fixed they will not need to make special
arrangements to handle old and new versions of the library.
Adds dispose functions for:
- libxl_dominfo
- libxl_cpupoolinfo
- libxl_physinfo
- libxl_sched_credit
- libxl_sched_credit2
I have attempted to fix any latent bugs in xl by inspection but have not
bothered with libxl (on the basis that internally the library is allowed to
make these sorts of assumptions and because it was looking like a very invasive
job and that more would only creep in anyway).
Several callsites use libxl_domain_info to check for the presence of a domain
and throw away the actual info. As a convenience accept a NULL info pointer and
just return the status.
Also fix a memory leak in libxl_domain_list.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r-- | tools/libxl/libxl_utils.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index a5b3c17f55..d6cd78d8f2 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -507,6 +507,22 @@ void libxl_cputopology_list_free(libxl_cputopology *list, int nr) free(list); } +void libxl_dominfo_list_free(libxl_dominfo *list, int nr) +{ + int i; + for (i = 0; i < nr; i++) + libxl_dominfo_dispose(&list[i]); + free(list); +} + +void libxl_vminfo_list_free(libxl_vminfo *list, int nr) +{ + int i; + for (i = 0; i < nr; i++) + libxl_vminfo_dispose(&list[i]); + free(list); +} + int libxl_domid_valid_guest(uint32_t domid) { /* returns 1 if the value _could_ be a valid guest domid, 0 otherwise |