* [PATCH] mini-os: Fix memory leaks in xs_read() and xs_write()
@ 2009-12-10 7:36 Yu Zhiguo
2009-12-10 13:43 ` Stefano Stabellini
0 siblings, 1 reply; 2+ messages in thread
From: Yu Zhiguo @ 2009-12-10 7:36 UTC (permalink / raw)
To: Keir Fraser, xen-devel@lists.xensource.com
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@cn.fujitsu.com>
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-10 13:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 7:36 [PATCH] mini-os: Fix memory leaks in xs_read() and xs_write() Yu Zhiguo
2009-12-10 13:43 ` Stefano Stabellini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.