[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] tools/libxl: Fix leaking ssid_label in libxl_name_to_domid
On Sat, Jan 26, 2019 at 10:45:07PM -0700, Tamas K Lengyel wrote: > On systems with XSM enabled libxl_name_to_domid leaks memory > allocated for ssid_label: > > ==2693== 53 bytes in 2 blocks are definitely lost in loss record 4 of 8 > ==2693== at 0x4C2BE6D: malloc (vg_replace_malloc.c:309) > ==2693== by 0x6C0A3B9: strdup (strdup.c:42) > ==2693== by 0x5108294: libxl_flask_sid_to_context (libxl_flask.c:39) > ==2693== by 0x50C2B64: libxl__xcinfo2xlinfo (libxl_domain.c:267) > ==2693== by 0x50C2E02: libxl_list_domain (libxl_domain.c:308) > ==2693== by 0x508A3C5: libxl_name_to_domid (libxl_utils.c:77) > > Signed-off-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> > Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> > Cc: Wei Liu <wei.liu2@xxxxxxxxxx> > --- > tools/libxl/libxl_utils.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c > index e50e094c48..99abfa5497 100644 > --- a/tools/libxl/libxl_utils.c > +++ b/tools/libxl/libxl_utils.c > @@ -79,6 +79,8 @@ int libxl_name_to_domid(libxl_ctx *ctx, const char *name, > return ERROR_NOMEM; > > for (i = 0; i < nb_domains; i++) { > + if (dominfo[i].ssid_label) > + free(dominfo[i].ssid_label); > domname = libxl_domid_to_name(ctx, dominfo[i].domid); > if (!domname) > continue; Thanks for reporting this issue. I think your patch isn't future-proof. Can you try the following patch? ---8<--- From fc9f9ad912cb61085a5bfb60aef3643dcd82a496 Mon Sep 17 00:00:00 2001 From: Wei Liu <wei.liu2@xxxxxxxxxx> Date: Mon, 28 Jan 2019 12:10:12 +0000 Subject: [PATCH] libxl: correctly dispose of dominfo list in libxl_name_to_domid Tamas reported ssid_label was leaked. Use the designated function to free dominfo list to fix the leakage. Reported-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index e50e094c48..f360f5e228 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -90,7 +90,7 @@ int libxl_name_to_domid(libxl_ctx *ctx, const char *name, } free(domname); } - free(dominfo); + libxl_dominfo_list_free(dominfo, nb_domains); return ret; } -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |