diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 8018d15bc8..6eb723ff76 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1819,10 +1819,14 @@ bool nlua_exec_file(const char *path) // Read all input from stdin, unless interrupted (ctrl-c). while (true) { if (got_int) { // User canceled. + file_close(&stdin_dup, false); + kv_destroy(sb); return false; } ptrdiff_t read_size = file_read(&stdin_dup, IObuff, 64); if (read_size < 0) { // Error. + file_close(&stdin_dup, false); + kv_destroy(sb); return false; } if (read_size > 0) {