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)