From e4af39cbc00446b03d142882a69813e94f0838b2 Mon Sep 17 00:00:00 2001 From: Crazy-P Date: Sun, 26 Aug 2018 09:19:02 +0800 Subject: Fixes several resource leaks in ... - gdscript - gdscript_compiler - regex - android/export - gles3/rasterizer (scene and storage) --- modules/regex/regex.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/regex') 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 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; } -- cgit v1.2.3