diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-15 13:41:38 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-15 13:41:38 +0000 |
commit | c124d925f84c2ef76f57cfe9925709f2fb71eadb (patch) | |
tree | 9a8e34897910a9e502e6b4bbfe20dee2fb1d00d2 /src/libserver | |
parent | f7f214e35357609cc0968bfc4c79374802a7a405 (diff) | |
download | rspamd-c124d925f84c2ef76f57cfe9925709f2fb71eadb.tar.gz rspamd-c124d925f84c2ef76f57cfe9925709f2fb71eadb.zip |
Fix a huge memory leak in hyperscan
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/re_cache.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index e9a18cfdd..82bd55dac 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -1440,7 +1440,22 @@ rspamd_re_cache_load_hyperscan (struct rspamd_re_cache *cache, } munmap (map, st.st_size); + + if (re_class->hs_scratch != NULL) { + hs_free_scratch (re_class->hs_scratch); + } + + if (re_class->hs_db != NULL) { + hs_free_database (re_class->hs_db); + } + + if (re_class->hs_ids) { + g_free (re_class->hs_ids); + } + + re_class->hs_ids = NULL; re_class->hs_scratch = NULL; + re_class->hs_db = NULL; g_assert (hs_alloc_scratch (re_class->hs_db, &re_class->hs_scratch) == HS_SUCCESS); |