# 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
|