ia64/xen-unstable

changeset 7614:4ec05d64f202

Fix memory leak in domain cleanup spotted by doremifa in #xen.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Nov 02 11:24:49 2005 +0100 (2005-11-02)
parents 89030fab2c3f
children d507f32afba9
files tools/console/daemon/io.c
line diff
     1.1 --- a/tools/console/daemon/io.c	Wed Nov 02 11:21:46 2005 +0100
     1.2 +++ b/tools/console/daemon/io.c	Wed Nov 02 11:24:49 2005 +0100
     1.3 @@ -380,12 +380,21 @@ static void cleanup_domain(struct domain
     1.4  	if (!buffer_empty(&d->buffer))
     1.5  		return;
     1.6  
     1.7 -	if (d->buffer.data)
     1.8 +	if (d->buffer.data) {
     1.9  		free(d->buffer.data);
    1.10 -	d->buffer.data = NULL;
    1.11 -	if (d->tty_fd != -1)
    1.12 +		d->buffer.data = NULL;
    1.13 +	}
    1.14 +
    1.15 +	if (d->tty_fd != -1) {
    1.16  		close(d->tty_fd);
    1.17 -	d->tty_fd = -1;
    1.18 +		d->tty_fd = -1;
    1.19 +	}
    1.20 +
    1.21 +	if (d->conspath) {
    1.22 +		free(d->conspath);
    1.23 +		d->conspath = NULL;
    1.24 +	}
    1.25 +
    1.26  	remove_domain(d);
    1.27  }
    1.28