diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-12-11 09:01:15 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-12-11 09:01:15 +0000 |
commit | feb567f2108efa3108aeb500dcee2a978774e336 (patch) | |
tree | 62265fbcbb2f9bb77600f32e0b9d57f61d1649f9 /extras/mini-os | |
parent | 0404e068491cfa5780a146aac96d452075425689 (diff) | |
download | xen-feb567f2108efa3108aeb500dcee2a978774e336.tar.gz xen-feb567f2108efa3108aeb500dcee2a978774e336.tar.bz2 xen-feb567f2108efa3108aeb500dcee2a978774e336.zip |
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@cn.fujitsu.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'extras/mini-os')
-rw-r--r-- | extras/mini-os/lib/xs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/extras/mini-os/lib/xs.c b/extras/mini-os/lib/xs.c index b654b0ee5d..6eced70347 100644 --- a/extras/mini-os/lib/xs.c +++ b/extras/mini-os/lib/xs.c @@ -49,6 +49,7 @@ void *xs_read(struct xs_handle *h, xs_transaction_t t, 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_transaction_t t, msg = xenbus_write(t, path, value); if (msg) { printk("xs_write(%s): %s\n", path, msg); + free(msg); return false; } return true; |