[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: fix memory leak in libxl_name_to_domid
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1280855361 -3600 # Node ID f6b91d2f9fa3437c37b17ad7b6d4d334217a6ba5 # Parent fd99dc9ab249caa8121464cb62049a1a7f69aad3 libxl: fix memory leak in libxl_name_to_domid Found with "valgrind xl destroy ...": ==16272== 53,248 bytes in 1 blocks are definitely lost in loss record 6 of 6 ==16272== at 0x4022249: calloc (vg_replace_malloc.c:467) ==16272== by 0x403FD4A: libxl_list_domain (libxl.c:490) ==16272== by 0x404B901: libxl_name_to_domid (libxl_utils.c:65) ==16272== by 0x804B4D2: domain_qualifier_to_domid (xl_cmdimpl.c:181) ==16272== by 0x804B50F: find_domain (xl_cmdimpl.c:198) ==16272== by 0x804D70C: destroy_domain (xl_cmdimpl.c:2104) ==16272== by 0x8054E4C: main_destroy (xl_cmdimpl.c:2912) ==16272== by 0x804B2FB: main (xl.c:76) Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- tools/libxl/libxl_utils.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff -r fd99dc9ab249 -r f6b91d2f9fa3 tools/libxl/libxl_utils.c --- a/tools/libxl/libxl_utils.c Tue Aug 03 17:41:03 2010 +0100 +++ b/tools/libxl/libxl_utils.c Tue Aug 03 18:09:21 2010 +0100 @@ -61,6 +61,7 @@ int libxl_name_to_domid(libxl_ctx *ctx, int i, nb_domains; char *domname; libxl_dominfo *dominfo; + int ret = -1; dominfo = libxl_list_domain(ctx, &nb_domains); if (!dominfo) @@ -72,10 +73,12 @@ int libxl_name_to_domid(libxl_ctx *ctx, continue; if (strcmp(domname, name) == 0) { *domid = dominfo[i].domid; - return 0; - } - } - return -1; + ret = 0; + break; + } + } + free(dominfo); + return ret; } char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |