From 8157bf2997e3e8521eacc8930f2984e230feff50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Benko?= Date: Wed, 7 Oct 2026 18:53:39 +0200 Subject: [PATCH] libtrap: fix container alloc size `t_cont_init()` multiplies the buffer capacity in bytes by `sizeof(char*)`, allocating eight times the required memory on 64-bit systems. This patch removes the `sizeof` multiplier. With the default pool of 50+64+1=115 containers (`t_mbuf_init()` called from `create_tcpip_sender_ifc()` or `create_tls_sender_ifc()`), this reduces requested buffer memory per interface from 92 MB to 11.5 MB. --- libtrap/src/trap_container.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtrap/src/trap_container.h b/libtrap/src/trap_container.h index cd36f4ce..250505ea 100644 --- a/libtrap/src/trap_container.h +++ b/libtrap/src/trap_container.h @@ -113,7 +113,7 @@ static inline int t_cont_init(struct trap_container_s* t_cont) { t_cont_clear(t_cont); - t_cont->buffer = malloc(container_buff_len * sizeof t_cont->buffer); + t_cont->buffer = malloc(container_buff_len); return t_cont->buffer ? 0 : 1; }