commit b0030d4: [Minor] Lua_task: Copy key when setting cache entries to avoid GC race
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Jan 31 11:42:03 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-01-31 11:39:37 +0000
URL: https://github.com/rspamd/rspamd/commit/b0030d4cd663ba83261ffb3965f31c64d27b8778 (HEAD -> master)
[Minor] Lua_task: Copy key when setting cache entries to avoid GC race
---
src/lua/lua_task.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 7b21ccc0d..b216eda69 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -1216,7 +1216,8 @@ lua_task_set_cached (lua_State *L, struct rspamd_task *task, const gchar *key,
}
else {
entry = rspamd_mempool_alloc (task->task_pool, sizeof (*entry));
- g_hash_table_insert (task->lua_cache, (void *)key, entry);
+ g_hash_table_insert (task->lua_cache,
+ rspamd_mempool_strdup (task->task_pool, key), entry);
}
entry->ref = luaL_ref (L, LUA_REGISTRYINDEX);
More information about the Commits
mailing list