aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/lang_detection.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-26 13:04:32 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-26 13:04:32 +0100
commit7e8b8d1cbba46acabe7d2883bacf6c2661977d1b (patch)
treec68281ef4c632d663955f33dfe342e6855c8e7fb /src/libmime/lang_detection.c
parenta0069bc1d16440c96c6af94c8d6981903bce39dd (diff)
downloadrspamd-7e8b8d1cbba46acabe7d2883bacf6c2661977d1b.tar.gz
rspamd-7e8b8d1cbba46acabe7d2883bacf6c2661977d1b.zip
[Minor] Plug more leaks
Diffstat (limited to 'src/libmime/lang_detection.c')
-rw-r--r--src/libmime/lang_detection.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index bb00fb31d..3f2a50134 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -494,7 +494,8 @@ rspamd_language_detector_read_file (struct rspamd_config *cfg,
rspamd_ftok_t *tok;
gchar *dst;
- tok = g_malloc (sizeof (*tok) + wlen + 1);
+ tok = rspamd_mempool_alloc (cfg->cfg_pool,
+ sizeof (*tok) + wlen + 1);
dst = ((gchar *)tok) + sizeof (*tok);
rspamd_strlcpy (dst, saved, wlen + 1);
tok->begin = dst;
@@ -737,8 +738,6 @@ static void
rspamd_language_detector_dtor (struct rspamd_lang_detector *d)
{
if (d) {
- rspamd_ftok_t *tok;
-
for (guint i = 0; i < RSPAMD_LANGUAGE_MAX; i ++) {
kh_destroy (rspamd_trigram_hash, d->trigramms[i]);
rspamd_multipattern_destroy (d->stop_words[i].mp);
@@ -749,10 +748,6 @@ rspamd_language_detector_dtor (struct rspamd_lang_detector *d)
g_ptr_array_free (d->languages, TRUE);
}
- kh_foreach_key (d->stop_words_norm, tok, {
- g_free (tok); /* String is embedded and freed automatically */
- });
-
kh_destroy (rspamd_stopwords_hash, d->stop_words_norm);
}
}