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-3.4-testing] mini-os: Fix memory leaks in xs_read()

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.4-testing] mini-os: Fix memory leaks in xs_read() and xs_write()
From: "Xen patchbot-3.4-testing" <patchbot-3.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Dec 2009 01:11:11 -0800
Delivery-date: Fri, 11 Dec 2009 01:18:43 -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 1260522407 0
# Node ID 122788bdebaeb3ce32e2a61e504f3df0a3809284
# Parent  8b5b13089f6ecb91e0f87c0863b3ba18917a2bc1
mini-os: Fix memory leaks in xs_read() and xs_write()

xenbus_read() and xenbus_write() will allocate memory for error
message if any error occurs, this memory should be freed.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
xen-unstable changeset:   20623:63ff27b3b07a
xen-unstable date:        Fri Dec 11 09:01:15 2009 +0000
---
 extras/mini-os/lib/xs.c |    2 ++
 1 files changed, 2 insertions(+)

diff -r 8b5b13089f6e -r 122788bdebae extras/mini-os/lib/xs.c
--- a/extras/mini-os/lib/xs.c   Fri Dec 11 09:06:13 2009 +0000
+++ b/extras/mini-os/lib/xs.c   Fri Dec 11 09:06:47 2009 +0000
@@ -49,6 +49,7 @@ void *xs_read(struct xs_handle *h, xs_tr
     msg = xenbus_read(t, path, &value);
     if (msg) {
        printk("xs_read(%s): %s\n", path, msg);
+       free(msg);
        return NULL;
     }
 
@@ -69,6 +70,7 @@ bool xs_write(struct xs_handle *h, xs_tr
     msg = xenbus_write(t, path, value);
     if (msg) {
        printk("xs_write(%s): %s\n", path, msg);
+       free(msg);
        return false;
     }
     return true;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.4-testing] mini-os: Fix memory leaks in xs_read() and xs_write(), Xen patchbot-3.4-testing <=