summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-18 17:23:30 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-18 17:23:30 +0000
commitcc27a6dcda6076d6db3a2bba740832c49dc11c2d (patch)
tree945dd74fba52b477beb89293fe8f98d0f8080ec0
parentf7b2b8e8bf205da930c1aa14704428600e3453ba (diff)
downloadrspamd-cc27a6dcda6076d6db3a2bba740832c49dc11c2d.tar.gz
rspamd-cc27a6dcda6076d6db3a2bba740832c49dc11c2d.zip
Fix refcounts.
-rw-r--r--src/libserver/spf.c13
-rw-r--r--src/plugins/spf.c6
2 files changed, 17 insertions, 2 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index eae35d352..4f0a40df5 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -1687,3 +1687,16 @@ resolve_spf (struct rspamd_task *task, spf_cb_t callback)
return FALSE;
}
+
+struct spf_resolved *
+spf_record_ref (struct spf_resolved *rec)
+{
+ REF_RETAIN (rec);
+ return rec;
+}
+
+void
+spf_record_unref (struct spf_resolved *rec)
+{
+ REF_RELEASE (rec);
+}
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index 08e4ec9c3..a2869d04a 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -302,10 +302,12 @@ spf_plugin_callback (struct spf_resolved *record, struct rspamd_task *task)
record->domain, task->tv.tv_sec)) == NULL) {
rspamd_lru_hash_insert (spf_module_ctx->spf_hash,
- record->domain,
- record, task->tv.tv_sec, record->ttl);
+ record->domain, spf_record_ref (record),
+ task->tv.tv_sec, record->ttl);
}
+ spf_record_ref (l);
spf_check_list (l, task);
+ spf_record_unref (l);
}
}