diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-10 15:59:20 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-10 15:59:20 +0000 |
commit | 35179d94a8af87c5b86e45d0bd1ba9a276d34844 (patch) | |
tree | 48cdfe4920faf992c15cb720083505e84bf10f50 /src | |
parent | 1ffd4fe64e1e3c9d4ae7cf942c7179a8715e4a63 (diff) | |
download | rspamd-35179d94a8af87c5b86e45d0bd1ba9a276d34844.tar.gz rspamd-35179d94a8af87c5b86e45d0bd1ba9a276d34844.zip |
[Minor] Allocate variable in the pool and avoid malloc
Diffstat (limited to 'src')
-rw-r--r-- | src/libstat/learn_cache/redis_cache.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c index 301232d28..a73a79b8c 100644 --- a/src/libstat/learn_cache/redis_cache.c +++ b/src/libstat/learn_cache/redis_cache.c @@ -222,7 +222,10 @@ rspamd_stat_cache_redis_generate_id (struct rspamd_task *task) rspamd_cryptobox_hash_final (&st, out); - b32out = rspamd_encode_base32 (out, sizeof (out)); + b32out = rspamd_mempool_alloc (task->task_pool, + sizeof (out) * 8 / 5 + 2); + rspamd_encode_base32_buf (out, sizeof (out), b32out, + sizeof (out) * 8 / 5 + 2); g_assert (b32out != NULL); rspamd_mempool_set_variable (task->task_pool, "words_hash", b32out, g_free); } |