void
rspamd_map_helper_destroy_hash (struct rspamd_hash_map_helper *r)
{
- if (r == NULL) {
+ if (r == NULL || r->pool == NULL) {
return;
}
+ rspamd_mempool_t *pool = r->pool;
kh_destroy (rspamd_map_hash, r->htb);
- rspamd_mempool_delete (r->pool);
+ memset (r, 0, sizeof (*r));
+ rspamd_mempool_delete (pool);
}
static void
void
rspamd_map_helper_destroy_radix (struct rspamd_radix_map_helper *r)
{
- if (r == NULL) {
+ if (r == NULL || !r->pool) {
return;
}
kh_destroy (rspamd_map_hash, r->htb);
- rspamd_mempool_delete (r->pool);
+ rspamd_mempool_t *pool = r->pool;
+ memset (r, 0, sizeof (*r));
+ rspamd_mempool_delete (pool);
}
static void
rspamd_regexp_t *re;
guint i;
- if (!re_map) {
+ if (!re_map || !re_map->regexps) {
return;
}
}
#endif
- rspamd_mempool_delete (re_map->pool);
+ rspamd_mempool_t *pool = re_map->pool;
+ memset (re_map, 0, sizeof (*re_map));
+ rspamd_mempool_delete (pool);
}
gchar *