From 105a72eabc6f74195b6319471344148726683b9d Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 21 Aug 2015 23:53:48 -0300 Subject: terminal: Fix use after free Since close_cb may free the terminal structure, save the "wipe" flag before calling it. --- src/nvim/terminal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 931105717b..98fc44c133 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -422,8 +422,9 @@ end: redraw(term->buf != curbuf); ui_busy_stop(); if (close) { + bool wipe = term->buf != NULL; term->opts.close_cb(term->opts.data); - if (term->buf) { + if (wipe) { do_cmdline_cmd("bwipeout!"); } } -- cgit