mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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:
1 parent
0404e06849
commit
feb567f210
1 file changed
+2
@@ -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;
|
||||
|
||||