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] libxc: fix a few memory leaks

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: fix a few memory leaks
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Oct 2009 02:40:10 -0700
Delivery-date: Fri, 23 Oct 2009 02:40:12 -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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1256288422 -3600
# Node ID 6d38985b00fcd809c3d0e5090fac5420f3a92293
# Parent  4a65bd76e09b152053202b2e58b536264935e6ef
libxc: fix a few memory leaks

running qemu with valgrind I found I couple of small memory leaks in
libxc, this patch fixes them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 tools/libxc/xc_linux.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -r 4a65bd76e09b -r 6d38985b00fc tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c    Fri Oct 23 09:59:45 2009 +0100
+++ b/tools/libxc/xc_linux.c    Fri Oct 23 10:00:22 2009 +0100
@@ -95,6 +95,7 @@ void *xc_map_foreign_range(int xc_handle
     xen_pfn_t *arr;
     int num;
     int i;
+    void *ret;
 
     num = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
     arr = calloc(num, sizeof(xen_pfn_t));
@@ -102,7 +103,9 @@ void *xc_map_foreign_range(int xc_handle
     for ( i = 0; i < num; i++ )
         arr[i] = mfn + i;
 
-    return xc_map_foreign_batch(xc_handle, dom, prot, arr, num);
+    ret = xc_map_foreign_batch(xc_handle, dom, prot, arr, num);
+    free(arr);
+    return ret;
 }
 
 void *xc_map_foreign_ranges(int xc_handle, uint32_t dom,
@@ -114,6 +117,7 @@ void *xc_map_foreign_ranges(int xc_handl
     int num;
     int i;
     int j;
+    void *ret;
 
     num_per_entry = chunksize >> PAGE_SHIFT;
     num = num_per_entry * nentries;
@@ -123,7 +127,9 @@ void *xc_map_foreign_ranges(int xc_handl
         for ( j = 0; j < num_per_entry; j++ )
             arr[i * num_per_entry + j] = entries[i].mfn + j;
 
-    return xc_map_foreign_batch(xc_handle, dom, prot, arr, num);
+    ret = xc_map_foreign_batch(xc_handle, dom, prot, arr, num);
+    free(arr);
+    return ret;
 }
 
 static int do_privcmd(int xc_handle, unsigned int cmd, unsigned long data)

_______________________________________________
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] libxc: fix a few memory leaks, Xen patchbot-unstable <=