diff options
| author | 2024-07-07 16:33:40 +0100 | |
|---|---|---|
| committer | 2024-07-07 16:33:40 +0100 | |
| commit | edd24460814edba9d8e482e34ec524668769b6ea (patch) | |
| tree | 4ea8e945785b76293465f79cb5c37549ca689563 /src/modules | |
| parent | Unregister extbans when the providing module is unloaded. (diff) | |
Fix a memory leak in the regex_pcre2 module.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/extra/m_regex_pcre2.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/modules/extra/m_regex_pcre2.cpp b/src/modules/extra/m_regex_pcre2.cpp index 35bc39b0f..5b5fa4995 100644 --- a/src/modules/extra/m_regex_pcre2.cpp +++ b/src/modules/extra/m_regex_pcre2.cpp @@ -80,7 +80,10 @@ public: pcre2_match_data* data = pcre2_match_data_create_from_pattern(regex, nullptr); int result = pcre2_match(regex, reinterpret_cast<PCRE2_SPTR8>(text.c_str()), text.length(), 0, 0, data, nullptr); if (result < 0) + { + pcre2_match_data_free(data); return std::nullopt; + } PCRE2_SIZE* ovector = pcre2_get_ovector_pointer(data); @@ -117,6 +120,7 @@ public: } } + pcre2_match_data_free(data); return Regex::MatchCollection(captures, namedcaptures); } }; |
