[lxc-devel] [PATCH] use correct number of ttys during setup

Sven Wegener sven.wegener at stealer.net
Wed Nov 25 18:14:35 UTC 2009


commit 985d15b106c8959ff130ba5425c2abbe36dc2cca "fix fdleak and errors
in lxc_create_tty()" created a zero-sized malloc(), causing memory
corruption. use config->tty like all the other code does.

Signed-off-by: Sven Wegener <sven.wegener at stealer.net>
---
 src/lxc/conf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

I already sent this one, but wasn't fully subscribed.

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 9c3a558..93bf719 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1002,7 +1002,7 @@ int lxc_create_tty(const char *name, struct lxc_conf *conf)
 		return 0;
 
 	tty_info->pty_info =
-		malloc(sizeof(*tty_info->pty_info)*tty_info->nbtty);
+		malloc(sizeof(*tty_info->pty_info)*conf->tty);
 	if (!tty_info->pty_info) {
 		SYSERROR("failed to allocate pty_info");
 		return -1;




More information about the lxc-devel mailing list