aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);