diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-06 13:58:39 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-06 13:58:39 +0000 |
commit | a3f2acd3f7388425bfc486234b9c1ca066a62f1a (patch) | |
tree | f8dfe260e87b7df5edc089be9c54913dc6f61c87 /src | |
parent | c25ecd901b07ba752e61bcf8c4d52d0d708ec413 (diff) | |
download | rspamd-a3f2acd3f7388425bfc486234b9c1ca066a62f1a.tar.gz rspamd-a3f2acd3f7388425bfc486234b9c1ca066a62f1a.zip |
[Minor] Fix race condition with LRU keys lifetime
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/spf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c index d21789c01..a282035be 100644 --- a/src/libserver/spf.c +++ b/src/libserver/spf.c @@ -219,7 +219,7 @@ spf_library_config (const ucl_object_t *obj) if (ucl_object_toint_safe (value, &ival) && ival > 0) { spf_lib_ctx->spf_hash = rspamd_lru_hash_new ( ival, - NULL, + g_free, spf_record_cached_unref_dtor); } } @@ -227,7 +227,7 @@ spf_library_config (const ucl_object_t *obj) /* Preserve compatibility */ spf_lib_ctx->spf_hash = rspamd_lru_hash_new ( 2048, - NULL, + g_free, spf_record_cached_unref_dtor); } } @@ -606,7 +606,8 @@ rspamd_spf_maybe_return (struct spf_record *rec) if (spf_lib_ctx->spf_hash) { rspamd_lru_hash_insert (spf_lib_ctx->spf_hash, - flat->domain, spf_record_ref (flat), + g_strdup (flat->domain), + spf_record_ref (flat), flat->timestamp, flat->ttl); msg_info_task ("stored record for %s (0x%xuL) in LRU cache for %d seconds, " |