aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-26 20:12:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-26 20:12:33 +0100
commit880300de81564ce2fa4664953fb2a42be9d0bcd0 (patch)
tree30da1cfca7ac0c398ddee480d5ee5c50ee0c4780 /src
parent0c3144ed76b67795a2ddc559a985b736b8155d69 (diff)
downloadrspamd-880300de81564ce2fa4664953fb2a42be9d0bcd0.tar.gz
rspamd-880300de81564ce2fa4664953fb2a42be9d0bcd0.zip
[Fix] Plug memory leak
Diffstat (limited to 'src')
-rw-r--r--src/libmime/scan_result.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c
index 6e6b30826..2ffe6e7ff 100644
--- a/src/libmime/scan_result.c
+++ b/src/libmime/scan_result.c
@@ -521,8 +521,11 @@ rspamd_task_add_result_option (struct rspamd_task *task,
gint r;
if (s && val) {
- if (s->options && !(s->sym &&
- (s->sym->flags & RSPAMD_SYMBOL_FLAG_ONEPARAM)) &&
+ if (!s->options) {
+ s->options = kh_init (rspamd_options_hash);
+ }
+
+ if (!(s->sym && (s->sym->flags & RSPAMD_SYMBOL_FLAG_ONEPARAM)) &&
kh_size (s->options) < task->cfg->default_max_shots) {
/* Append new options */
k = kh_get (rspamd_options_hash, s->options, val);
@@ -540,7 +543,6 @@ rspamd_task_add_result_option (struct rspamd_task *task,
}
}
else {
- s->options = kh_init (rspamd_options_hash);
opt = rspamd_mempool_alloc0 (task->task_pool, sizeof (*opt));
opt_cpy = rspamd_mempool_strdup (task->task_pool, val);
k = kh_put (rspamd_options_hash, s->options, opt_cpy, &r);