tty.c: Refactor, move LIST_REMOVE() to tty_unregister()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-11-12 21:33:22 +01:00
parent b6e695b656
commit af3e560d79
+2 -1
View File
@@ -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)