api: fix leak when a api function is incorrectly called with a list.

This applies both to msgpack-rpc and eval.
This commit is contained in:
Björn Linse
2016-07-16 16:51:56 +02:00
parent 98a08c3e5a
commit acb7c826b3
4 changed files with 9 additions and 10 deletions

View File

@@ -303,4 +303,11 @@ describe('vim_* functions', function()
eq(false, status)
ok(err:match('Invalid option name') ~= nil)
end)
it("doesn't leak memory on incorrect argument types", function()
local status, err = pcall(nvim, 'change_directory',{'not', 'a', 'dir'})
eq(false, status)
ok(err:match(': Wrong type for argument 1, expecting String') ~= nil)
end)
end)