diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-17 16:53:20 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-17 16:53:20 +0000 |
commit | 6ff5a8debb423d1c7b62f18833cdd500876848af (patch) | |
tree | 25e76b93869c9c844aacda9c7ba34e0f8eab299d /src/plugins/chartable.c | |
parent | 5dd52de750ce5dfbbe182d204d0a66498bc69a9a (diff) | |
download | rspamd-6ff5a8debb423d1c7b62f18833cdd500876848af.tar.gz rspamd-6ff5a8debb423d1c7b62f18833cdd500876848af.zip |
[Fix] Fix memory leak on reload in plugins
Diffstat (limited to 'src/plugins/chartable.c')
-rw-r--r-- | src/plugins/chartable.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index bfc5d2378..3b5a0f717 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -78,10 +78,12 @@ static void chartable_url_symbol_callback (struct rspamd_task *task, void *unuse gint chartable_module_init (struct rspamd_config *cfg, struct module_ctx **ctx) { - chartable_module_ctx = g_malloc (sizeof (struct chartable_ctx)); + if (chartable_module_ctx == NULL) { + chartable_module_ctx = g_malloc (sizeof (struct chartable_ctx)); - chartable_module_ctx->chartable_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL); - chartable_module_ctx->max_word_len = 10; + chartable_module_ctx->chartable_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL); + chartable_module_ctx->max_word_len = 10; + } *ctx = (struct module_ctx *)chartable_module_ctx; |