Skip to content

Commit 54c1364

Browse files
committed
Fixes
1 parent acad49e commit 54c1364

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/switch_regex.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ SWITCH_DECLARE(int) switch_regex_copy_substring(switch_regex_match_t *match_data
4949

5050
SWITCH_DECLARE(void) switch_regex_match_free(void *data)
5151
{
52-
pcre2_match_context_free(data);
52+
pcre2_match_data_free(data);
5353

5454
}
5555

@@ -138,8 +138,13 @@ SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expressi
138138
switch_regex_safe_free(re);
139139
}
140140

141-
*new_re = (switch_regex_t *)re;
142-
*new_match_data = (switch_regex_match_t *)match_data;
141+
if (new_re) {
142+
*new_re = (switch_regex_t *)re;
143+
}
144+
145+
if (new_match_data) {
146+
*new_match_data = (switch_regex_match_t *)match_data;
147+
}
143148

144149
end:
145150
switch_safe_free(tmp);

0 commit comments

Comments
 (0)