termio: free resources for discarded messages

Messages can own allocated data or a derived config. Some paths (writer
thread draining, mailbox shutdown with unread messages, and queue push
failures) discarded messages without releasing those resources.

This change adds Message.deinit and uses it whenever a message is
discarded.
This commit is contained in:
Jon Parise
2026-08-03 14:24:58 -04:00
parent ac04fc2761
commit 2f7fbadb0b
4 changed files with 20 additions and 6 deletions

View File

@@ -298,7 +298,7 @@ fn drainMailbox(
// If we're draining, we just drain the mailbox and return.
if (self.flags.drain) {
while (mailbox.pop(global.io())) |_| {}
while (mailbox.pop(global.io())) |msg| msg.deinit();
return;
}