From: Vsevolod Stakhov Date: Wed, 19 Nov 2025 17:19:40 +0000 (+0000) Subject: [Fix] Fix memory leak in custom tokenizer result handling X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ed7c2e3d188742dde896b447a2ed33dd42a9680;p=thirdparty%2Frspamd.git [Fix] Fix memory leak in custom tokenizer result handling Free dynamically allocated kvec array after copying tokens to avoid memory leak when using custom tokenizers with exceptions. --- diff --git a/src/libstat/tokenizers/tokenizers.c b/src/libstat/tokenizers/tokenizers.c index 8a9f429924..6179ae0017 100644 --- a/src/libstat/tokenizers/tokenizers.c +++ b/src/libstat/tokenizers/tokenizers.c @@ -379,6 +379,9 @@ rspamd_tokenize_text(const char *text, gsize len, *hash = mum_hash_finish(hv); } + /* Free the dynamically allocated array from custom tokenizer */ + kv_destroy(*custom_res); + return res; } else {