aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-11-02 11:24:49 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-11-02 11:24:49 +0100
commit68917d13804741e323ac17b8b40e1e65b655160a (patch)
tree5fa6f72776e85fc30fd90b0527b646226ecc0195 /tools/console
parenta108cd00521e6f5f49ddfeb40d48511927d2bc94 (diff)
downloadxen-68917d13804741e323ac17b8b40e1e65b655160a.tar.gz
xen-68917d13804741e323ac17b8b40e1e65b655160a.tar.bz2
xen-68917d13804741e323ac17b8b40e1e65b655160a.zip
Fix memory leak in domain cleanup spotted by doremifa in #xen.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/daemon/io.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index ef3f094d27..d4593f0d80 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -380,12 +380,21 @@ static void cleanup_domain(struct domain *d)
if (!buffer_empty(&d->buffer))
return;
- if (d->buffer.data)
+ if (d->buffer.data) {
free(d->buffer.data);
- d->buffer.data = NULL;
- if (d->tty_fd != -1)
+ d->buffer.data = NULL;
+ }
+
+ if (d->tty_fd != -1) {
close(d->tty_fd);
- d->tty_fd = -1;
+ d->tty_fd = -1;
+ }
+
+ if (d->conspath) {
+ free(d->conspath);
+ d->conspath = NULL;
+ }
+
remove_domain(d);
}