]> source.dussan.org Git - rspamd.git/commitdiff
[CritFix] Fix memory leak in spf caching logic
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 14 Oct 2017 17:51:16 +0000 (18:51 +0100)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 17 Oct 2017 22:26:16 +0000 (00:26 +0200)
MFH: rspamd-1.6

src/plugins/spf.c

index 097df7329eda2e6504061671881555d19aa5e569..737d6634892ba8f15d24cdd8a3559c42424f4be9 100644 (file)
@@ -526,15 +526,15 @@ spf_plugin_callback (struct spf_resolved *record, struct rspamd_task *task,
 
                if ((l = rspamd_lru_hash_lookup (spf_module_ctx->spf_hash,
                                        record->domain, task->tv.tv_sec)) == NULL) {
-
-                       l = spf_record_ref (record);
+                       l = record;
 
                        if (record->ttl > 0 &&
                                        !record->temp_failed &&
                                        !record->perm_failed &&
                                        !record->na) {
+
                                rspamd_lru_hash_insert (spf_module_ctx->spf_hash,
-                                               record->domain, l,
+                                               record->domain, spf_record_ref (l),
                                                task->tv.tv_sec, record->ttl);
                        }