aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 16:52:45 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 16:52:45 +0000
commit7672a0ae2ef3ea7d6c79f1f9de5f3d9d1cd84b85 (patch)
tree080b389d00619447bfc62501be825d0f59dec49d
parentf4149123c25d3850197acb93265c4a02c522a497 (diff)
downloadrspamd-7672a0ae2ef3ea7d6c79f1f9de5f3d9d1cd84b85.tar.gz
rspamd-7672a0ae2ef3ea7d6c79f1f9de5f3d9d1cd84b85.zip
[Fix] Plug reload leaks
-rw-r--r--src/controller.c3
-rw-r--r--src/fuzzy_storage.c3
-rw-r--r--src/hs_helper.c2
-rw-r--r--src/rspamd_proxy.c3
-rw-r--r--src/worker.c3
5 files changed, 9 insertions, 5 deletions
diff --git a/src/controller.c b/src/controller.c
index 48c89c408..675671aa0 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -3051,7 +3051,8 @@ init_controller_worker (struct rspamd_config *cfg)
type = g_quark_try_string ("controller");
- ctx = g_malloc0 (sizeof (struct rspamd_controller_worker_ctx));
+ ctx = rspamd_mempool_alloc0 (cfg->cfg_pool,
+ sizeof (struct rspamd_controller_worker_ctx));
ctx->magic = rspamd_controller_ctx_magic;
ctx->timeout = DEFAULT_WORKER_IO_TIMEOUT;
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 94dfa906c..7a980ceef 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -2021,7 +2021,8 @@ init_fuzzy (struct rspamd_config *cfg)
type = g_quark_try_string ("fuzzy");
- ctx = g_malloc0 (sizeof (struct rspamd_fuzzy_storage_ctx));
+ ctx = rspamd_mempool_alloc0 (cfg->cfg_pool,
+ sizeof (struct rspamd_fuzzy_storage_ctx));
ctx->magic = rspamd_fuzzy_storage_magic;
ctx->sync_timeout = DEFAULT_SYNC_TIMEOUT;
diff --git a/src/hs_helper.c b/src/hs_helper.c
index 088aba8ae..94e50e721 100644
--- a/src/hs_helper.c
+++ b/src/hs_helper.c
@@ -62,7 +62,7 @@ init_hs_helper (struct rspamd_config *cfg)
GQuark type;
type = g_quark_try_string ("hs_helper");
- ctx = g_malloc0 (sizeof (*ctx));
+ ctx = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*ctx));
ctx->magic = rspamd_hs_helper_magic;
ctx->cfg = cfg;
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index d4a2c1b57..8e2b205b7 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -620,7 +620,8 @@ init_rspamd_proxy (struct rspamd_config *cfg)
type = g_quark_try_string ("rspamd_proxy");
- ctx = g_malloc0 (sizeof (struct rspamd_proxy_ctx));
+ ctx = rspamd_mempool_alloc (cfg->cfg_pool,
+ sizeof (struct rspamd_proxy_ctx));
ctx->magic = rspamd_rspamd_proxy_magic;
ctx->timeout = 10.0;
ctx->upstreams = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal);
diff --git a/src/worker.c b/src/worker.c
index 9d4b175a3..bf50e5210 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -488,7 +488,8 @@ init_worker (struct rspamd_config *cfg)
type = g_quark_try_string ("normal");
- ctx = g_malloc0 (sizeof (struct rspamd_worker_ctx));
+ ctx = rspamd_mempool_alloc (cfg->cfg_pool,
+ sizeof (struct rspamd_worker_ctx));
ctx->magic = rspamd_worker_magic;
ctx->is_mime = TRUE;