diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-01-31 11:39:37 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-01-31 11:39:37 +0000 |
commit | b0030d4cd663ba83261ffb3965f31c64d27b8778 (patch) | |
tree | cba92736d49ca5225419748da67e9f46d0578458 | |
parent | 64df50450deffdc134671ecacb8e883f7c532eea (diff) | |
download | rspamd-b0030d4cd663ba83261ffb3965f31c64d27b8778.tar.gz rspamd-b0030d4cd663ba83261ffb3965f31c64d27b8778.zip |
[Minor] Lua_task: Copy key when setting cache entries to avoid GC race
-rw-r--r-- | src/lua/lua_task.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |