diff options
| author | stargazer <163490937+uss-stargazer@users.noreply.github.com> | 2026-03-20 05:02:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-20 05:02:26 -0400 |
| commit | bf92be622e1e6e097192f9de51c049803f50308d (patch) | |
| tree | c8090e439f000dc3fe9b792955359c7d1bba663a /lua | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-bf92be622e1e6e097192f9de51c049803f50308d.tar nvim-lspconfig-bf92be622e1e6e097192f9de51c049803f50308d.tar.gz nvim-lspconfig-bf92be622e1e6e097192f9de51c049803f50308d.tar.bz2 nvim-lspconfig-bf92be622e1e6e097192f9de51c049803f50308d.tar.lz nvim-lspconfig-bf92be622e1e6e097192f9de51c049803f50308d.tar.xz nvim-lspconfig-bf92be622e1e6e097192f9de51c049803f50308d.tar.zst nvim-lspconfig-bf92be622e1e6e097192f9de51c049803f50308d.zip | |
fix: prevent file leak in `root_markers_with_field()` #4355
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 931cbe3d..2282e3e2 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -63,12 +63,14 @@ function M.root_markers_with_field(root_files, new_names, field, fname) for _, f in ipairs(found or {}) do -- Match the given `field`. - for line in io.lines(f) do + local file = assert(io.open(f, 'r')) + for line in file:lines() do if line:find(field) then root_files[#root_files + 1] = vim.fs.basename(f) break end end + file:close() end return root_files |
