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>
This commit is contained in:
Keir Fraser committed 2009-12-11 09:01:15 +00:00
1 parent 0404e06849
commit feb567f210
1 file changed
+2
+2
View File
@@ -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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.