aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-12-03 09:44:08 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-12-03 09:44:08 -0500
commit930e58c56d75d585b560dc30df217e87b6feaee0 (patch)
tree26f6458d2e5c25da6b3e73a0283685972fd0d025
parentcb86eca91f9bdffe8b0214664169093d41902415 (diff)
parenteae3105ee3ebc09549f2db2c1f3125a74c223c41 (diff)
downloadrneovim-930e58c56d75d585b560dc30df217e87b6feaee0.tar.gz
rneovim-930e58c56d75d585b560dc30df217e87b6feaee0.tar.bz2
rneovim-930e58c56d75d585b560dc30df217e87b6feaee0.zip
Merge pull request #1534 from oni-link/fix.leak.detected.in.1510
Fix memory leak detected in #1510.
-rw-r--r--src/nvim/msgpack_rpc/channel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 0c04a7b23e..b6ac3fab82 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -241,6 +241,7 @@ Object channel_send_call(uint64_t id,
if (frame.errored) {
api_set_error(err, Exception, "%s", frame.result.data.string.data);
+ api_free_object(frame.result);
return NIL;
}
@@ -347,7 +348,13 @@ static void job_err(RStream *rstream, void *data, bool eof)
static void job_exit(Job *job, void *data)
{
- free_channel((Channel *)data);
+ Channel *channel = data;
+ // ensure the channel is flagged as closed so channel_send_call frees it
+ // later
+ channel->closed = true;
+ if (!kv_size(channel->call_stack)) {
+ free_channel(channel);
+ }
}
static void parse_msgpack(RStream *rstream, void *data, bool eof)