summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_cfg_file.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index 0a63164f5..9df0a02ce 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -40,7 +40,7 @@ lua_process_metric (lua_State *L, const gchar *name, struct rspamd_config *cfg)
{
GList *metric_list;
gchar *symbol;
- const gchar *desc;
+ const gchar *desc = NULL;
struct metric *metric;
gdouble *score;
struct rspamd_symbol_def *s;
@@ -74,7 +74,6 @@ lua_process_metric (lua_State *L, const gchar *name, struct rspamd_config *cfg)
lua_gettable (L, -2);
if (lua_isstring (L, -1)) {
desc = lua_tostring (L, -1);
- s->description = rspamd_mempool_strdup (cfg->cfg_pool, desc);
}
lua_pop (L, 1);
}
@@ -103,6 +102,10 @@ lua_process_metric (lua_State *L, const gchar *name, struct rspamd_config *cfg)
g_hash_table_insert (metric->symbols, symbol, s);
}
+ if (desc) {
+ s->description = rspamd_mempool_strdup (cfg->cfg_pool, desc);
+ }
+
if ((metric_list =
g_hash_table_lookup (cfg->metrics_symbols, symbol)) == NULL) {
metric_list = g_list_prepend (NULL, metric);