]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] Fix allocator mismatches with jemalloc
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 2 Nov 2025 19:29:38 +0000 (19:29 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 2 Nov 2025 19:36:32 +0000 (19:36 +0000)
commit7c1e555a3fbb42e1a6f37a1f0300ea864e4076cd
treed3c59bfe53e06ecb47129da56c10ebb74b497c97
parent8e0b2aae32fbdc08efe8d1ca144ed688e36de85b
[Fix] Fix allocator mismatches with jemalloc

Resolve crashes caused by mixing system malloc and jemalloc allocators.
The issue occurred when getline() and hiredis used system malloc, but
rspamd's free() used jemalloc, causing segmentation faults on macOS and
potentially other platforms.

Changes:
- Add rspamd_getline() wrapper using g_malloc/g_realloc/g_free to avoid
  system malloc in getline()
- Replace getline() with rspamd_getline() in url.c, dns.c, lua_repl.c
- Fix memory leak in lua_repl.c by freeing input buffer on exit
- Configure hiredis allocators to use glib functions (jemalloc) in
  rspamd_init_libs()

This ensures all memory operations use the same allocator (jemalloc)
throughout rspamd, preventing allocator mismatch crashes.
src/libserver/cfg_utils.cxx
src/libserver/dns.c
src/libserver/url.c
src/libutil/str_util.c
src/libutil/str_util.h
src/rspamadm/lua_repl.c