diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-28 13:34:45 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-28 13:34:45 +0100 |
commit | 770d90c78c00a407e2980ba2ff38ea640dae070e (patch) | |
tree | 877bfc1cf6416ce5350dfcb9c3c7b145e90ba24a /src | |
parent | 6b0f46e3217b68fe38686e85d6a2139a3c70873d (diff) | |
download | rspamd-770d90c78c00a407e2980ba2ff38ea640dae070e.tar.gz rspamd-770d90c78c00a407e2980ba2ff38ea640dae070e.zip |
Fix lua symbols registration.
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_config.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 6d1d3a8e5..410595d08 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -861,26 +861,24 @@ rspamd_register_symbol_fromlua (lua_State *L, struct lua_callback_data *cd; gint ret = -1; - if (name) { - cd = rspamd_mempool_alloc0 (cfg->cfg_pool, - sizeof (struct lua_callback_data)); - cd->cb_is_ref = TRUE; - cd->callback.ref = ref; - cd->L = L; - cd->symbol = rspamd_mempool_strdup (cfg->cfg_pool, name); - - ret = rspamd_symbols_cache_add_symbol (cfg->cache, - name, - weight, - priority, - lua_metric_symbol_callback, - cd, - type, - parent); - rspamd_mempool_add_destructor (cfg->cfg_pool, - (rspamd_mempool_destruct_t)lua_destroy_cfg_symbol, - cd); - } + cd = rspamd_mempool_alloc0 (cfg->cfg_pool, + sizeof (struct lua_callback_data)); + cd->cb_is_ref = TRUE; + cd->callback.ref = ref; + cd->L = L; + cd->symbol = rspamd_mempool_strdup (cfg->cfg_pool, name); + + ret = rspamd_symbols_cache_add_symbol (cfg->cache, + name, + weight, + priority, + lua_metric_symbol_callback, + cd, + type, + parent); + rspamd_mempool_add_destructor (cfg->cfg_pool, + (rspamd_mempool_destruct_t)lua_destroy_cfg_symbol, + cd); return ret; } |