From acfb7121275dee018b221ef34b7f5fa7026675b5 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 5 Dec 2012 18:47:08 +0000 Subject: [PATCH] tty: Clean up completely if switching vt fails The code under the "err" label closes the file descriptor and frees the allocated memory. --- src/tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tty.c b/src/tty.c index 6d58aa5c..05e5e20f 100644 --- a/src/tty.c +++ b/src/tty.c @@ -174,7 +174,7 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func, if (ioctl(tty->fd, VT_ACTIVATE, tty->vt) < 0 || ioctl(tty->fd, VT_WAITACTIVE, tty->vt) < 0) { weston_log("failed to swtich to new vt\n"); - return NULL; + goto err; } }