commit 0049505: [Fix] Mempool: Fix alloc_array function to actually multiply nmembers by size

Vsevolod Stakhov vsevolod at rspamd.com
Wed Jun 29 19:56:09 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-06-29 20:52:55 +0100
URL: https://github.com/rspamd/rspamd/commit/0049505d4f2b5b3f9510a1b5472a56dc4415cba3 (HEAD -> master)

[Fix] Mempool: Fix alloc_array function to actually multiply nmembers by size
Found by: @citrin

---
 src/libutil/mem_pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c
index 235fc8421..779aff15a 100644
--- a/src/libutil/mem_pool.c
+++ b/src/libutil/mem_pool.c
@@ -575,7 +575,7 @@ rspamd_mempool_alloc_array_ (rspamd_mempool_t * pool,  gsize nmemb, gsize size,
 				nmemb, size);
 		g_abort();
 	}
-	return memory_pool_alloc_common (pool, size, alignment, RSPAMD_MEMPOOL_NORMAL, loc);
+	return memory_pool_alloc_common (pool, size * nmemb, alignment, RSPAMD_MEMPOOL_NORMAL, loc);
 }
 
 void *


More information about the Commits mailing list