From: Vsevolod Stakhov Date: Tue, 10 Mar 2020 15:59:20 +0000 (+0000) Subject: [Minor] Allocate variable in the pool and avoid malloc X-Git-Tag: 2.5~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35179d94a8af87c5b86e45d0bd1ba9a276d34844;p=thirdparty%2Frspamd.git [Minor] Allocate variable in the pool and avoid malloc --- diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c index 301232d28e..a73a79b8c7 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); }