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] tools: Fix a few error-path memory leaks.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools: Fix a few error-path memory leaks.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 09 Dec 2008 08:30:14 -0800
Delivery-date: Tue, 09 Dec 2008 08:30:17 -0800
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 1228827199 0
# Node ID f7f8f44b9292a30707bd645739390ef3d0f22232
# Parent  c0c113ab0be528f56aec2854c544535a4245853e
tools: Fix a few error-path memory leaks.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/python/xen/lowlevel/acm/acm.c     |    2 ++
 tools/python/xen/lowlevel/flask/flask.c |    1 +
 tools/python/xen/lowlevel/xc/xc.c       |   11 +++++++----
 3 files changed, 10 insertions(+), 4 deletions(-)

diff -r c0c113ab0be5 -r f7f8f44b9292 tools/python/xen/lowlevel/acm/acm.c
--- a/tools/python/xen/lowlevel/acm/acm.c       Tue Dec 09 12:45:45 2008 +0000
+++ b/tools/python/xen/lowlevel/acm/acm.c       Tue Dec 09 12:53:19 2008 +0000
@@ -68,6 +68,8 @@ static void *__getssid(int domid, uint32
         goto out2;
     } else {
         *buflen = SSID_BUFFER_SIZE;
+        free(buf);
+        buf = NULL;
         goto out2;
     }
  out2:
diff -r c0c113ab0be5 -r f7f8f44b9292 tools/python/xen/lowlevel/flask/flask.c
--- a/tools/python/xen/lowlevel/flask/flask.c   Tue Dec 09 12:45:45 2008 +0000
+++ b/tools/python/xen/lowlevel/flask/flask.c   Tue Dec 09 12:53:19 2008 +0000
@@ -55,6 +55,7 @@ static PyObject *pyflask_context_to_sid(
     xc_handle = xc_interface_open();
     if (xc_handle < 0) {
         errno = xc_handle;
+        free(buf);
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
diff -r c0c113ab0be5 -r f7f8f44b9292 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Tue Dec 09 12:45:45 2008 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Dec 09 12:53:19 2008 +0000
@@ -678,19 +678,22 @@ static PyObject *pyxc_get_device_group(X
 
     if ( rc < 0 )
     {
-      free(sdev_array); 
-      return pyxc_error_to_exception();
+        free(sdev_array); 
+        return pyxc_error_to_exception();
     }
 
     if ( !num_sdevs )
     {
-       free(sdev_array);
-       return Py_BuildValue("s", "");
+        free(sdev_array);
+        return Py_BuildValue("s", "");
     }
 
     group_str = calloc(num_sdevs, sizeof(dev_str));
     if (group_str == NULL)
+    {
+        free(sdev_array);
         return PyErr_NoMemory();
+    }
 
     for ( i = 0; i < num_sdevs; i++ )
     {

_______________________________________________
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] tools: Fix a few error-path memory leaks., Xen patchbot-unstable <=