Merge pull request #53160 from hanfei1991/hanfei/fix-mem-leak

fix mem leak in RegExpTreeDictionary
This commit is contained in:
Han Fei 2023-08-08 17:34:07 +02:00 committed by GitHub
commit 5020b572ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -346,7 +346,7 @@ void RegExpTreeDictionary::loadData()
ids[i] = static_cast<unsigned>(i+1);
hs_error_t err = hs_compile_lit_multi(patterns.data(), flags.data(), ids.get(), lengths.data(), static_cast<unsigned>(patterns.size()), HS_MODE_BLOCK, nullptr, &db, &compile_error);
origin_db = (db);
origin_db.reset(db);
if (err != HS_SUCCESS)
{
/// CompilerError is a unique_ptr, so correct memory free after the exception is thrown.
@ -658,7 +658,7 @@ std::unordered_map<String, ColumnPtr> RegExpTreeDictionary::match(
};
hs_error_t err = hs_scan(
origin_db,
origin_db.get(),
reinterpret_cast<const char *>(keys_data.data()) + offset,
static_cast<unsigned>(length),
0,

View File

@ -199,7 +199,7 @@ private:
#if USE_VECTORSCAN
MultiRegexps::DeferredConstructedRegexpsPtr hyperscan_regex;
MultiRegexps::ScratchPtr origin_scratch;
hs_database_t* origin_db;
MultiRegexps::DataBasePtr origin_db;
#endif
Poco::Logger * logger;