]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix memory leak in custom tokenizer result handling
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 19 Nov 2025 17:19:40 +0000 (17:19 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 19 Nov 2025 17:19:40 +0000 (17:19 +0000)
Free dynamically allocated kvec array after copying tokens to avoid
memory leak when using custom tokenizers with exceptions.

src/libstat/tokenizers/tokenizers.c

index 8a9f42992448cde465907c04a6831ade24c3a1fd..6179ae0017447e0e71a61b106570fdfe0a1d2ad0 100644 (file)
@@ -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 {