commit 6b9ff5491d4a15c7ec92d70a769b3cc35ea06da9
parent c545d514dfe1f45f86a54b313082c5171bb0ce1b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 25 Aug 2022 06:41:04 +0800
fix(treesitter): free memory on removing parser (#19933)
This fixes the ASAN failure.
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git 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;