summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_map.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-11 17:32:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-11 17:33:15 +0100
commit249183c0b56d8cbb56fbb70e88406def3b688100 (patch)
treed5f3facb9b36271e63d0fc69091cbbd0d3dfa56d /src/lua/lua_map.c
parentdefc166a58568c5ec33bb68de22255bd09ea3c12 (diff)
downloadrspamd-249183c0b56d8cbb56fbb70e88406def3b688100.tar.gz
rspamd-249183c0b56d8cbb56fbb70e88406def3b688100.zip
[Minor] Fix one more issue with empty maps
Diffstat (limited to 'src/lua/lua_map.c')
-rw-r--r--src/lua/lua_map.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c
index 40b2ecedc..2d5b5e9c2 100644
--- a/src/lua/lua_map.c
+++ b/src/lua/lua_map.c
@@ -223,8 +223,7 @@ lua_config_add_hash_map (lua_State *L)
map_line = luaL_checkstring (L, 2);
description = lua_tostring (L, 3);
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
- map->data.hash = g_hash_table_new (rspamd_strcase_hash,
- rspamd_strcase_equal);
+ map->data.hash = NULL;
map->type = RSPAMD_LUA_MAP_SET;
if ((m = rspamd_map_add (cfg, map_line, description,
@@ -232,7 +231,6 @@ lua_config_add_hash_map (lua_State *L)
rspamd_hosts_fin,
(void **)&map->data.hash)) == NULL) {
msg_warn_config ("invalid set map %s", map_line);
- g_hash_table_destroy (map->data.hash);
lua_pushnil (L);
return 1;
}
@@ -262,8 +260,7 @@ lua_config_add_kv_map (lua_State *L)
map_line = luaL_checkstring (L, 2);
description = lua_tostring (L, 3);
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
- map->data.hash = g_hash_table_new (rspamd_strcase_hash,
- rspamd_strcase_equal);
+ map->data.hash = NULL;
map->type = RSPAMD_LUA_MAP_HASH;
if ((m = rspamd_map_add (cfg, map_line, description,
@@ -271,8 +268,8 @@ lua_config_add_kv_map (lua_State *L)
rspamd_kv_list_fin,
(void **)&map->data.hash)) == NULL) {
msg_warn_config ("invalid hash map %s", map_line);
- g_hash_table_destroy (map->data.hash);
lua_pushnil (L);
+
return 1;
}