aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-12-24 14:34:47 +0100
committerGitHub <noreply@github.com>2020-12-24 14:34:47 +0100
commit4dfc5bb2d0464c5775ea9f1b0240bf7a8f53b709 (patch)
tree398e92c26d7bd2f865cc8287bda379ebe8541234 /src
parent7afd4526f2ee018ef611f91bfe1b0cb8ed2fc4c6 (diff)
parent95352f490a24f5e3a1cc788d297105e4eadf1481 (diff)
downloadrneovim-4dfc5bb2d0464c5775ea9f1b0240bf7a8f53b709.tar.gz
rneovim-4dfc5bb2d0464c5775ea9f1b0240bf7a8f53b709.tar.bz2
rneovim-4dfc5bb2d0464c5775ea9f1b0240bf7a8f53b709.zip
Merge pull request #13537 from bfredl/rpcabort
rpc: don't handle stale requests on already closed channel
Diffstat (limited to 'src')
-rw-r--r--src/nvim/msgpack_rpc/channel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 68ef4cd41e..a0b439ac45 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -377,6 +377,10 @@ static void request_event(void **argv)
Channel *channel = e->channel;
MsgpackRpcRequestHandler handler = e->handler;
Error error = ERROR_INIT;
+ if (channel->rpc.closed) {
+ // channel was closed, abort any pending requests
+ goto free_ret;
+ }
Object result = handler.fn(channel->id, e->args, &error);
if (e->type == kMessageTypeRequest || ERROR_SET(&error)) {
// Send the response.
@@ -391,6 +395,8 @@ static void request_event(void **argv)
} else {
api_free_object(result);
}
+
+free_ret:
api_free_array(e->args);
channel_decref(channel);
xfree(e);