WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: fix memory leak in libxl_name_to_d

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: fix memory leak in libxl_name_to_domid
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 05 Aug 2010 01:35:18 -0700
Delivery-date: Thu, 05 Aug 2010 01:36:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: fix memory leak in libxl_name_to_domid, Xen patchbot-unstable <=