diff options
| author | Barrett Ruth <62671086+barrettruth@users.noreply.github.com> | 2026-04-24 14:13:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-24 14:13:24 -0400 |
| commit | 393f687503a319a6f521e8335b4dd8030e3ea67b (patch) | |
| tree | 34f6ac7bbf44dbe9df577e3bf363dd37402906d4 /runtime/syntax/javascriptreact.vim | |
| parent | 58aad59e1cf89e2bee0fc2e02c42506d2b1feeaf (diff) | |
fix(api): leak preview callback LuaRef in nvim_create_user_command #39357
Problem:
Invalid `nvim_create_user_command` calls can leak the
`preview` callback reference after Neovim has taken ownership of it.
1. build with {a,l}san
2. run:
```sh
<path/to/nvim> --headless -u NONE --clean +'lua
for i = 1, 100 do
pcall(vim.api.nvim_create_user_command,
"some very epic stuff" .. i,
{}, -- NOTE: this is INVALID (not a function or string)
{ preview = function() end })
end
vim.cmd("qa!")
' +qa
```
3. see:
```
100 lua references were leaked!
```
Solution:
Clear `preview_luaref` in `err:`.
Diffstat (limited to 'runtime/syntax/javascriptreact.vim')
0 files changed, 0 insertions, 0 deletions
