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

[Xen-devel] [PATCH] 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>

diff --git a/extras/mini-os/lib/xs.c b/extras/mini-os/lib/xs.c
--- a/extras/mini-os/lib/xs.c
+++ b/extras/mini-os/lib/xs.c
@@ -49,6 +49,7 @@
     msg = xenbus_read(t, path, &value);
     if (msg) {
        printk("xs_read(%s): %s\n", path, msg);
+       free(msg);
        return NULL;
     }
 
@@ -69,6 +70,7 @@
     msg = xenbus_write(t, path, value);
     if (msg) {
        printk("xs_write(%s): %s\n", path, msg);
+       free(msg);
        return false;
     }
     return true;



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


 


Rackspace

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