소스 검색

regex: Add nullptr check in `_regex_free`, needed with PCRE2 10.42

Fixes #76174.

(cherry picked from commit 290db4a0b6c636b123297a8cbfa448ab6af76642)
Rémi Verschelde 2 년 전
부모
커밋
4044b19100
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      modules/regex/regex.cpp

+ 3 - 1
modules/regex/regex.cpp

@@ -40,7 +40,9 @@ static void *_regex_malloc(PCRE2_SIZE size, void *user) {
 }
 
 static void _regex_free(void *ptr, void *user) {
-	memfree(ptr);
+	if (ptr) {
+		memfree(ptr);
+	}
 }
 
 int RegExMatch::_find(const Variant &p_name) const {