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;
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);
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);
}
}
g_ptr_array_free (cache->postfilters, TRUE);
g_ptr_array_free (cache->idempotent, TRUE);
g_ptr_array_free (cache->composites, TRUE);
+ g_ptr_array_free (cache->virtual, TRUE);
REF_RELEASE (cache->items_by_order);
if (cache->peak_cb != -1) {
g_array_free (tp->normalized_hashes, TRUE);
}
if (tp->languages) {
- g_ptr_array_unref (tp->languages);
+ g_ptr_array_free (tp->languages, TRUE);
}
}
{
struct map_periodic_cbdata *cbd = (struct map_periodic_cbdata *)w->data;
+ MAP_RETAIN (cbd, "periodic");
ev_timer_stop (loop, w);
rspamd_map_process_periodic (cbd);
+ MAP_RELEASE (cbd, "periodic");
}
static void