summaryrefslogtreecommitdiffstats
path: root/src/plugins/regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 16:53:20 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 16:53:20 +0000
commit6ff5a8debb423d1c7b62f18833cdd500876848af (patch)
tree25e76b93869c9c844aacda9c7ba34e0f8eab299d /src/plugins/regexp.c
parent5dd52de750ce5dfbbe182d204d0a66498bc69a9a (diff)
downloadrspamd-6ff5a8debb423d1c7b62f18833cdd500876848af.tar.gz
rspamd-6ff5a8debb423d1c7b62f18833cdd500876848af.zip
[Fix] Fix memory leak on reload in plugins
Diffstat (limited to 'src/plugins/regexp.c')
-rw-r--r--src/plugins/regexp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index a88bde21b..f2d3ab2c3 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -91,9 +91,10 @@ read_regexp_expression (rspamd_mempool_t * pool,
gint
regexp_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
- regexp_module_ctx = g_malloc (sizeof (struct regexp_ctx));
-
- regexp_module_ctx->regexp_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ if (regexp_module_ctx == NULL) {
+ regexp_module_ctx = g_malloc (sizeof (struct regexp_ctx));
+ regexp_module_ctx->regexp_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ }
*ctx = (struct module_ctx *)regexp_module_ctx;