diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-20 14:45:38 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-20 14:45:38 +0000 |
commit | 62c21d15b6221fee0a0a3a51cf14593810136eb0 (patch) | |
tree | 12a3e0b30b2bf0da67c21b955d946140befedd1f /src/plugins/surbl.c | |
parent | 86f76528fa2b3c3603c649835bbc4d0a21ed0a4d (diff) | |
download | rspamd-62c21d15b6221fee0a0a3a51cf14593810136eb0.tar.gz rspamd-62c21d15b6221fee0a0a3a51cf14593810136eb0.zip |
[Fix] Fix reload memory issue
Diffstat (limited to 'src/plugins/surbl.c')
-rw-r--r-- | src/plugins/surbl.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index 7ee9269b2..95bef9c2d 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -132,7 +132,7 @@ read_exceptions_list (gchar * chunk, gboolean final) { if (data->cur_data == NULL) { - data->cur_data = g_malloc0 (sizeof (GHashTable *) * MAX_LEVELS); + data->cur_data = data->prev_data; } return rspamd_parse_kv_list ( chunk, @@ -155,8 +155,8 @@ fin_exceptions_list (struct map_cb_data *data) if (t[i] != NULL) { g_hash_table_destroy (t[i]); } + t[i] = NULL; } - g_free (t); } } @@ -264,12 +264,12 @@ surbl_module_init (struct rspamd_config *cfg, struct module_ctx **ctx) surbl_module_ctx->redirectors = NULL; surbl_module_ctx->whitelist = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal); - /* Zero exceptions hashes */ - surbl_module_ctx->exceptions = g_malloc0 (MAX_LEVELS * sizeof (GHashTable *)); - /* Register destructors */ rspamd_mempool_add_destructor (surbl_module_ctx->surbl_pool, - (rspamd_mempool_destruct_t) g_hash_table_destroy, - surbl_module_ctx->whitelist); + (rspamd_mempool_destruct_t) g_hash_table_destroy, + surbl_module_ctx->whitelist); + surbl_module_ctx->exceptions = rspamd_mempool_alloc0 ( + surbl_module_ctx->surbl_pool, MAX_LEVELS * sizeof (GHashTable *)); + *ctx = (struct module_ctx *)surbl_module_ctx; |