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

This commit is contained in:
Ibrahn Sahir 2018-11-15 13:36:40 +00:00
parent 35aa3301d7
commit f8a1c77fcf
1 changed files with 6 additions and 2 deletions

View File

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