From af3e560d792747303323f3430a13831780cc91e3 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 12 Nov 2017 21:33:22 +0100 Subject: [PATCH] tty.c: Refactor, move LIST_REMOVE() to tty_unregister() Signed-off-by: Joachim Nilsson --- src/tty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tty.c b/src/tty.c index f1db1bcb..2e813143 100644 --- a/src/tty.c +++ b/src/tty.c @@ -119,7 +119,6 @@ void tty_sweep(void) if (tty->dirty == -1) { _d("TTY %s removed, cleaning up.", tty->data.name); - LIST_REMOVE(tty, link); tty_unregister(tty); } } @@ -292,6 +291,8 @@ int tty_unregister(tty_node_t *tty) return errno = EINVAL; } + LIST_REMOVE(tty, link); + if (tty->data.name) free(tty->data.name); if (tty->data.baud)