[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] tools/libxl: Fix leaking ssid_label in libxl_name_to_domid



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;
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.