[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2 of 3] libxl: fix memory leak in libxl_name_to_domid
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1280752237 -3600 # Node ID 2a932193a3fac4f861f0c6353a2d251077012a61 # Parent b3e1074b137c03131cea33c5100cbc2fa6cc5d5f 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> diff -r b3e1074b137c -r 2a932193a3fa tools/libxl/libxl_utils.c --- a/tools/libxl/libxl_utils.c Mon Aug 02 13:30:37 2010 +0100 +++ b/tools/libxl/libxl_utils.c Mon Aug 02 13:30:37 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; + ret = 0; + break; } } - return -1; + free(dominfo); + return ret; } char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |