summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorBarrett Ruth <62671086+barrettruth@users.noreply.github.com>2026-04-23 06:31:24 -0400
committerGitHub <noreply@github.com>2026-04-23 06:31:24 -0400
commit19ef632decf7e5d3d9bb70f347c88b92c138b45e (patch)
treefa4f52a26cde03d3b341c810b6356b3ffaaa732c /src
parenta4ad469fb1f935aed6f84cfa9e663ab4f7ca1e02 (diff)
fix(terminal): memory leak in pending TermRequest StringBuilder #39333
Problem: Destroying a terminal with pending `TermRequest` events leaks memory. Solution: Make `emit_termrequest` the sole owner of its `pending_send` allocation.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/terminal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 96b2d8e215..004a00265a 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -247,6 +247,8 @@ static void emit_termrequest(void **argv)
buf_T *buf = handle_get_buffer(buf_handle);
if (!buf || buf->terminal == NULL) { // Terminal already closed.
xfree(sequence);
+ kv_destroy(*pending_send);
+ xfree(pending_send);
return;
}
Terminal *term = buf->terminal;
@@ -1232,7 +1234,6 @@ void terminal_destroy(Terminal **termpp)
kv_destroy(term->selection);
kv_destroy(term->termrequest_buffer);
vterm_free(term->vt);
- xfree(term->pending.send);
multiqueue_free(term->pending.events);
xfree(term);
*termpp = NULL; // coverity[dead-store]