mini-os: Fix memory leaks in xs_read() and xs_write()
PATCH 1/1 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 <[email protected]>
extras/mini-os/lib/xs.c +2 -0
@@ -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;
Quoted 6 lines · Yu Zhiguo
xenbus_read()andxenbus_write()will allocate memory for error message if any error occurs, this memory should be freed.Signed-off-by Yu Zhiguo <[email protected]>