From: Vsevolod Stakhov Date: Fri, 15 Jan 2016 13:41:38 +0000 (+0000) Subject: Fix a huge memory leak in hyperscan X-Git-Tag: 1.1.0~34 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c124d925f84c2ef76f57cfe9925709f2fb71eadb;p=rspamd.git Fix a huge memory leak in hyperscan --- 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);