aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-18 11:34:49 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-18 11:35:08 +0100
commitf41ac57b3a61a1abfe562a930734a45f36ba5604 (patch)
treead1de91706d55c2ef4e65c3c9690465d2e2820bc /src
parent3d6d9f5d17921ae75ef95a75ba46b90c8efe715e (diff)
downloadrspamd-f41ac57b3a61a1abfe562a930734a45f36ba5604.tar.gz
rspamd-f41ac57b3a61a1abfe562a930734a45f36ba5604.zip
[Fix] Fix use-after-free
Diffstat (limited to 'src')
-rw-r--r--src/libutil/map_helpers.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libutil/map_helpers.c b/src/libutil/map_helpers.c
index 9f3dacad8..a9bd8d70e 100644
--- a/src/libutil/map_helpers.c
+++ b/src/libutil/map_helpers.c
@@ -770,15 +770,6 @@ rspamd_map_helper_destroy_regexp (struct rspamd_regexp_map_helper *re_map)
return;
}
- for (i = 0; i < re_map->regexps->len; i ++) {
- re = g_ptr_array_index (re_map->regexps, i);
- rspamd_regexp_unref (re);
- }
-
- g_ptr_array_free (re_map->regexps, TRUE);
- g_ptr_array_free (re_map->values, TRUE);
- kh_destroy (rspamd_map_hash, re_map->htb);
-
#ifdef WITH_HYPERSCAN
if (re_map->hs_scratch) {
hs_free_scratch (re_map->hs_scratch);
@@ -801,6 +792,15 @@ rspamd_map_helper_destroy_regexp (struct rspamd_regexp_map_helper *re_map)
}
#endif
+ for (i = 0; i < re_map->regexps->len; i ++) {
+ re = g_ptr_array_index (re_map->regexps, i);
+ rspamd_regexp_unref (re);
+ }
+
+ g_ptr_array_free (re_map->regexps, TRUE);
+ g_ptr_array_free (re_map->values, TRUE);
+ kh_destroy (rspamd_map_hash, re_map->htb);
+
rspamd_mempool_t *pool = re_map->pool;
memset (re_map, 0, sizeof (*re_map));
rspamd_mempool_delete (pool);