summaryrefslogtreecommitdiff
path: root/modules/regex
diff options
context:
space:
mode:
authorCrazy-P <patrickolsen@myw.dk>2018-08-26 09:19:02 +0800
committerCrazy-P <patrickolsen@myw.dk>2018-08-26 09:19:02 +0800
commite4af39cbc00446b03d142882a69813e94f0838b2 (patch)
tree2b7ec12aeba47ce12e515795bfc6563148f11878 /modules/regex
parent8c435a343e9739f30cb2e347df95835c91c1ff1a (diff)
Fixes several resource leaks in ...
- gdscript - gdscript_compiler - regex - android/export - gles3/rasterizer (scene and storage)
Diffstat (limited to 'modules/regex')
-rw-r--r--modules/regex/regex.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp
index 733f32277b..bdd3e31eb8 100644
--- a/modules/regex/regex.cpp
+++ b/modules/regex/regex.cpp
@@ -205,6 +205,8 @@ Error RegEx::compile(const String &p_pattern) {
code = pcre2_compile_16(p, pattern.length(), flags, &err, &offset, cctx);
+ pcre2_compile_context_free_16(cctx);
+
if (!code) {
PCRE2_UCHAR16 buf[256];
pcre2_get_error_message_16(err, buf, 256);
@@ -221,6 +223,8 @@ Error RegEx::compile(const String &p_pattern) {
code = pcre2_compile_32(p, pattern.length(), flags, &err, &offset, cctx);
+ pcre2_compile_context_free_32(cctx);
+
if (!code) {
PCRE2_UCHAR32 buf[256];
pcre2_get_error_message_32(err, buf, 256);
@@ -285,6 +289,8 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
if (res < 0) {
pcre2_match_data_free_32(match);
+ pcre2_match_context_free_32(mctx);
+
return NULL;
}