aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-25 06:41:04 +0800
committerGitHub <noreply@github.com>2022-08-25 06:41:04 +0800
commit6b9ff5491d4a15c7ec92d70a769b3cc35ea06da9 (patch)
tree7e6643eb9bc19ada050313addb05e1e0729d92b1
parentc545d514dfe1f45f86a54b313082c5171bb0ce1b (diff)
downloadrneovim-6b9ff5491d4a15c7ec92d70a769b3cc35ea06da9.tar.gz
rneovim-6b9ff5491d4a15c7ec92d70a769b3cc35ea06da9.tar.bz2
rneovim-6b9ff5491d4a15c7ec92d70a769b3cc35ea06da9.zip
fix(treesitter): free memory on removing parser (#19933)
This fixes the ASAN failure.
-rw-r--r--src/nvim/lua/treesitter.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index 8b47939169..954c3410d3 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -216,7 +216,9 @@ int tslua_remove_lang(lua_State *L)
const char *lang_name = luaL_checkstring(L, 1);
bool present = pmap_has(cstr_t)(&langs, lang_name);
if (present) {
+ char *key = (char *)pmap_key(cstr_t)(&langs, lang_name);
pmap_del(cstr_t)(&langs, lang_name);
+ xfree(key);
}
lua_pushboolean(L, present);
return 1;