g_assert (ls->dyn.allocated <= G_MAXINT16);
ls->dyn.allocated *= 2;
- new_array = rspamd_mempool_alloc (pool, ls->dyn.allocated);
+ new_array = rspamd_mempool_alloc (pool,
+ ls->dyn.allocated * sizeof (guint32));
memcpy (new_array, ls->dyn.n, ls->dyn.len * sizeof (guint32));
ls->dyn.n = new_array;
ls->dyn.n[ls->dyn.len++] = id;
}
else {
/* Switch to dynamic */
- new_array = rspamd_mempool_alloc (pool, G_N_ELEMENTS (ls->st) * 2);
+ new_array = rspamd_mempool_alloc (pool,
+ G_N_ELEMENTS (ls->st) * 2 * sizeof (guint32));
memcpy (new_array, ls->st, G_N_ELEMENTS (ls->st) * sizeof (guint32));
ls->dyn.n = new_array;
ls->dyn.e = -1;
struct rspamd_config_cfg_lua_script *sc;
struct rspamd_config **pcfg;
- LL_FOREACH (cfg->post_init_scripts, sc) {
+ LL_FOREACH (cfg->config_unload_scripts, sc) {
lua_pushcfunction (L, &rspamd_lua_traceback);
gint err_idx = lua_gettop (L);