From 295e7607c472b49e8c0762977e38c4527b746b6f Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 29 Jan 2017 19:32:01 +0300 Subject: executor: Fix some memory leaks --- src/nvim/viml/executor/executor.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/nvim/viml/executor/executor.c b/src/nvim/viml/executor/executor.c index c426806b6f..df63667102 100644 --- a/src/nvim/viml/executor/executor.c +++ b/src/nvim/viml/executor/executor.c @@ -182,8 +182,14 @@ static int nlua_exec_luado_string(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL if (luaL_loadbuffer(lstate, lcmd, lcmd_len, NLUA_EVAL_NAME)) { nlua_error(lstate, _("E5109: Error while creating lua chunk: %.*s")); + if (lcmd_len >= IOSIZE) { + xfree(lcmd); + } return 0; } + if (lcmd_len >= IOSIZE) { + xfree(lcmd); + } if (lua_pcall(lstate, 0, 1, 0)) { nlua_error(lstate, _("E5110: Error while creating lua function: %.*s")); return 0; -- cgit