aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api
diff options
context:
space:
mode:
authorCai Rijun (Richard) <1297550+cairijun@users.noreply.github.com>2025-02-11 01:37:36 +0800
committerGitHub <noreply@github.com>2025-02-10 09:37:36 -0800
commitad60b3fb4806c0917010bbe97876c22fb57cabcd (patch)
tree925042c2974797a5c3cfb5698f15762e1cf87c3a /test/functional/api
parent524cdd35c2ae3babc1824257da523615507e7af9 (diff)
downloadrneovim-ad60b3fb4806c0917010bbe97876c22fb57cabcd.tar.gz
rneovim-ad60b3fb4806c0917010bbe97876c22fb57cabcd.tar.bz2
rneovim-ad60b3fb4806c0917010bbe97876c22fb57cabcd.zip
fix(api): memory leaks in vim.api.nvim_*get_option #32390
Problem: `get_option_value` returns caller owned `Object`s but the corresponding C apis do not marked `FUNC_API_RET_ALLOC` properly. Solution: add `FUNC_API_RET_ALLOC` to the C apis.
Diffstat (limited to 'test/functional/api')
-rw-r--r--test/functional/api/deprecated_spec.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/api/deprecated_spec.lua b/test/functional/api/deprecated_spec.lua
index 2efcfda873..d967bfa743 100644
--- a/test/functional/api/deprecated_spec.lua
+++ b/test/functional/api/deprecated_spec.lua
@@ -18,4 +18,15 @@ describe('deprecated', function()
n.api.nvim_notify('hello world', 4, {})
end)
end)
+
+ describe('nvim_*get_option functions', function()
+ it('does not leak memory', function()
+ -- String opts caused memory leaks in these functions in Github#32361
+ n.exec_lua([[
+ vim.api.nvim_get_option('rtp')
+ vim.api.nvim_win_get_option(vim.api.nvim_get_current_win(), 'foldmethod')
+ vim.api.nvim_buf_get_option(0, 'fileformat')
+ ]])
+ end)
+ end)
end)