aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-19 16:28:42 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-19 16:29:21 +0100
commit9bea98bce3ba8588ec41487e3cdc2bf6f28c6167 (patch)
treeb251e5628c8091cae6bf8508cd77fdee9086b602
parente3dc1d07f68861388895bd1f76b639189ec9cbb6 (diff)
downloadrspamd-9bea98bce3ba8588ec41487e3cdc2bf6f28c6167.tar.gz
rspamd-9bea98bce3ba8588ec41487e3cdc2bf6f28c6167.zip
One more try to fix memset.
-rw-r--r--src/plugins/dkim_check.c7
-rw-r--r--src/plugins/fuzzy_check.c8
-rw-r--r--src/plugins/regexp.c5
-rw-r--r--src/plugins/spf.c7
4 files changed, 20 insertions, 7 deletions
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index 28bdbf3c3..9e88ab310 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -254,14 +254,17 @@ dkim_module_config (struct rspamd_config *cfg)
gint
dkim_module_reconfig (struct rspamd_config *cfg)
{
+ struct module_ctx saved_ctx;
+
+ saved_ctx = dkim_module_ctx->ctx;
rspamd_mempool_delete (dkim_module_ctx->dkim_pool);
radix_destroy_compressed (dkim_module_ctx->whitelist_ip);
if (dkim_module_ctx->dkim_domains) {
g_hash_table_destroy (dkim_module_ctx->dkim_domains);
}
- memset (dkim_module_ctx + sizeof (dkim_module_ctx->ctx),
- 0, sizeof (*dkim_module_ctx) - sizeof (dkim_module_ctx->ctx));
+ memset (dkim_module_ctx, 0, sizeof (*dkim_module_ctx));
+ dkim_module_ctx->ctx = saved_ctx;
dkim_module_ctx->dkim_pool = rspamd_mempool_new (
rspamd_mempool_suggest_size ());
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 61966ccb9..498e1485e 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -497,10 +497,12 @@ fuzzy_check_module_config (struct rspamd_config *cfg)
gint
fuzzy_check_module_reconfig (struct rspamd_config *cfg)
{
- rspamd_mempool_delete (fuzzy_module_ctx->fuzzy_pool);
+ struct module_ctx saved_ctx;
- memset (fuzzy_module_ctx + sizeof (fuzzy_module_ctx->ctx),
- 0, sizeof (*fuzzy_module_ctx) - sizeof (fuzzy_module_ctx->ctx));
+ saved_ctx = fuzzy_module_ctx->ctx;
+ rspamd_mempool_delete (fuzzy_module_ctx->fuzzy_pool);
+ memset (fuzzy_module_ctx, 0, sizeof (*fuzzy_module_ctx));
+ fuzzy_module_ctx->ctx = saved_ctx;
fuzzy_module_ctx->fuzzy_pool = rspamd_mempool_new (
rspamd_mempool_suggest_size ());
fuzzy_module_ctx->cfg = cfg;
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index 59f5427df..8df81a9e6 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -172,7 +172,12 @@ regexp_module_config (struct rspamd_config *cfg)
gint
regexp_module_reconfig (struct rspamd_config *cfg)
{
+ struct module_ctx saved_ctx;
+
+ saved_ctx = regexp_module_ctx->ctx;
rspamd_mempool_delete (regexp_module_ctx->regexp_pool);
+ memset (regexp_module_ctx, 0, sizeof (*regexp_module_ctx));
+ regexp_module_ctx->ctx = saved_ctx;
regexp_module_ctx->regexp_pool = rspamd_mempool_new (
rspamd_mempool_suggest_size ());
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index c444199ba..8e03334fb 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -172,10 +172,13 @@ spf_module_config (struct rspamd_config *cfg)
gint
spf_module_reconfig (struct rspamd_config *cfg)
{
+ struct module_ctx saved_ctx;
+
+ saved_ctx = spf_module_ctx->ctx;
rspamd_mempool_delete (spf_module_ctx->spf_pool);
radix_destroy_compressed (spf_module_ctx->whitelist_ip);
- memset (spf_module_ctx + sizeof (spf_module_ctx->ctx),
- 0, sizeof (*spf_module_ctx) - sizeof (spf_module_ctx->ctx));
+ memset (spf_module_ctx, 0, sizeof (*spf_module_ctx));
+ spf_module_ctx->ctx = saved_ctx;
spf_module_ctx->spf_pool = rspamd_mempool_new (
rspamd_mempool_suggest_size ());