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/
Home Products Support Community News


[Xen-changelog] [xen-unstable] mini-os: Fix memory leaks in xs_read() an

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] mini-os: Fix memory leaks in xs_read() and xs_write()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Dec 2009 01:10:47 -0800
Delivery-date: Fri, 11 Dec 2009 01:17:39 -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 1260522075 0
# Node ID 63ff27b3b07ad884613e32fe06909bb20e354378
# Parent  f61303bcc3ac6fbf67b9f92183fecc4b6f26d324
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>
 extras/mini-os/lib/xs.c |    2 ++
 1 files changed, 2 insertions(+)

diff -r f61303bcc3ac -r 63ff27b3b07a extras/mini-os/lib/xs.c
--- a/extras/mini-os/lib/xs.c   Fri Dec 11 09:00:40 2009 +0000
+++ b/extras/mini-os/lib/xs.c   Fri Dec 11 09:01:15 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

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