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

@@ -872,10 +872,9 @@ fn queueIo(
switch (msg) {
.write_small,
.write_stable,
=> return,
.write_alloc => |v| {
v.alloc.free(v.data);
.write_alloc,
=> {
msg.deinit();
return;
},