From: Vsevolod Stakhov Date: Fri, 15 Jun 2018 13:11:30 +0000 (+0100) Subject: [Minor] More init leaks X-Git-Tag: 1.7.6~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c08f35e976223b58cf76e8cfe2dac8f457e32fee;p=rspamd.git [Minor] More init leaks --- diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index cf7f8d847..6083d655f 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -1450,9 +1450,8 @@ rspamd_init_filters (struct rspamd_config *cfg, bool reconfig) mod = *pmod; if (rspamd_check_module (cfg, mod)) { - mod_ctx = g_malloc0 (sizeof (struct module_ctx)); - if (mod->module_init_func (cfg, &mod_ctx) == 0) { + g_assert (mod_ctx != NULL); g_hash_table_insert (cfg->c_modules, (gpointer) mod->name, mod_ctx); diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c index 55275cba4..ed9f24b15 100644 --- a/src/libserver/dynamic_cfg.c +++ b/src/libserver/dynamic_cfg.c @@ -262,6 +262,9 @@ init_dynamic_config (struct rspamd_config *cfg) rspamd_mempool_add_destructor (cfg->cfg_pool, (rspamd_mempool_destruct_t)ucl_object_unref, cfg->current_dynamic_conf); + rspamd_mempool_add_destructor (cfg->cfg_pool, + (rspamd_mempool_destruct_t)g_free, + pjb); if (!rspamd_map_add (cfg, cfg->dynamic_conf, diff --git a/src/rspamd.c b/src/rspamd.c index 777726478..34436bd10 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -1498,6 +1498,7 @@ main (gint argc, gchar **argv, gchar **env) rspamd_log_close (rspamd_main->logger); REF_RELEASE (rspamd_main->cfg); g_hash_table_unref (rspamd_main->spairs); + g_hash_table_unref (rspamd_main->workers); rspamd_mempool_delete (rspamd_main->server_pool); if (!skip_pid) { @@ -1507,5 +1508,9 @@ main (gint argc, gchar **argv, gchar **env) g_free (rspamd_main); event_base_free (ev_base); + if (control_addr) { + rspamd_inet_address_free (control_addr); + } + return (res); }