From acb7c826b3df50bd9825baf3b2ffaaa79c8b80df Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 16 Jul 2016 16:51:56 +0200 Subject: api: fix leak when a api function is incorrectly called with a list. This applies both to msgpack-rpc and eval. --- src/nvim/eval.c | 3 +-- src/nvim/msgpack_rpc/channel.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index ac34ad4923..bfe4707dab 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7140,8 +7140,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr) } end: - // All arguments were freed already, but we still need to free the array - xfree(args.items); + api_free_array(args); api_free_object(result); } diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 8b5f212d66..cd12f258b6 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -465,8 +465,7 @@ static void on_request_event(void **argv) } else { api_free_object(result); } - // All arguments were freed already, but we still need to free the array - xfree(args.items); + api_free_array(args); decref(channel); xfree(e); } -- cgit