[PATCH 6/9] tty: Clean up completely if switching vt fails

Rob Bradford robert.bradford at intel.com
Wed Dec 5 10:47:08 PST 2012


From: Rob Bradford <rob at linux.intel.com>

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 6d58aa5..05e5e20 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;
 		}
 	}
 
-- 
1.7.11.7



More information about the wayland-devel mailing list