Browse Source

Assign pointer null in RegEx::clear to avoid double free on destruction.

Ibrahn Sahir 7 năm trước cách đây
mục cha
commit
f8a1c77fcf
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      modules/regex/regex.cpp

+ 6 - 2
modules/regex/regex.cpp

@@ -178,13 +178,17 @@ void RegEx::clear() {
 
 	if (sizeof(CharType) == 2) {
 
-		if (code)
+		if (code) {
 			pcre2_code_free_16((pcre2_code_16 *)code);
+			code = NULL;
+		}
 
 	} else {
 
-		if (code)
+		if (code) {
 			pcre2_code_free_32((pcre2_code_32 *)code);
+			code = NULL;
+		}
 	}
 }