[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



# 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
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.