+ /* Free the match data */
+ if (reg->match_data) {
+ pcre2_match_data_free(reg->match_data);
+ reg->match_data = NULL;
+ }
+
+ /* Free the regex */
+ if (reg->regex) {
+ pcre2_code_free(reg->regex);
+ reg->regex = NULL;
+ }
+
+ /* Free the patter, */
+ if (reg->pattern) {
+ free(reg->pattern);
+ reg->pattern = NULL;