aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorror Proton <107091537+horror-proton@users.noreply.github.com>2025-01-14 00:43:33 +0800
committerLewis Russell <me@lewisr.dev>2025-01-14 09:15:35 +0000
commit5a54681025ec28129c21c875943a3f9c37959f75 (patch)
tree4f3f179f7ba5d080b62468dc7a732c16551f4328
parent0dfa4de9933b548d050feeff5676d580c7103787 (diff)
downloadrneovim-5a54681025ec28129c21c875943a3f9c37959f75.tar.gz
rneovim-5a54681025ec28129c21c875943a3f9c37959f75.tar.bz2
rneovim-5a54681025ec28129c21c875943a3f9c37959f75.zip
fix(treesitter): uv_dlclose after uv_dlerror
-rw-r--r--src/nvim/lua/treesitter.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index 9bd2baad27..3493384a8f 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -128,9 +128,9 @@ static const TSLanguage *load_language_from_object(lua_State *L, const char *pat
{
uv_lib_t lib;
if (uv_dlopen(path, &lib)) {
+ xstrlcpy(IObuff, uv_dlerror(&lib), sizeof(IObuff));
uv_dlclose(&lib);
- luaL_error(L, "Failed to load parser for language '%s': uv_dlopen: %s",
- lang_name, uv_dlerror(&lib));
+ luaL_error(L, "Failed to load parser for language '%s': uv_dlopen: %s", lang_name, IObuff);
}
char symbol_buf[128];
@@ -138,8 +138,9 @@ static const TSLanguage *load_language_from_object(lua_State *L, const char *pat
TSLanguage *(*lang_parser)(void);
if (uv_dlsym(&lib, symbol_buf, (void **)&lang_parser)) {
+ xstrlcpy(IObuff, uv_dlerror(&lib), sizeof(IObuff));
uv_dlclose(&lib);
- luaL_error(L, "Failed to load parser: uv_dlsym: %s", uv_dlerror(&lib));
+ luaL_error(L, "Failed to load parser: uv_dlsym: %s", IObuff);
}
TSLanguage *lang = lang_parser();