mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-30 12:59:24 +00:00
FS-10240: [freeswitch-core] Use the "Negative Lookahead" in xml dialplan cause memory leak #resolve
Conflicts: src/switch_channel.c
This commit is contained in:
parent
595a5fc15a
commit
1eb5ee1a84
@ -4392,7 +4392,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
|||||||
X = malloc(len);
|
X = malloc(len);
|
||||||
|
|
||||||
for (i = 0; i < proceed; i++) {
|
for (i = 0; i < proceed; i++) {
|
||||||
if (pcre_get_substring(dtstr, ovector, proceed, i, &replace) > 0) {
|
if (pcre_get_substring(dtstr, ovector, proceed, i, &replace) >= 0) {
|
||||||
|
if (replace) {
|
||||||
switch_size_t plen = strlen(replace);
|
switch_size_t plen = strlen(replace);
|
||||||
memset(X, 'X', plen);
|
memset(X, 'X', plen);
|
||||||
*(X+plen) = '\0';
|
*(X+plen) = '\0';
|
||||||
@ -4403,6 +4404,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
|||||||
pcre_free_substring(replace);
|
pcre_free_substring(replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!zstr(substituted)) {
|
if (!zstr(substituted)) {
|
||||||
digit_string = substituted;
|
digit_string = substituted;
|
||||||
|
@ -174,13 +174,16 @@ SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_c
|
|||||||
num = -1;
|
num = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcre_get_substring(field_data, ovector, match_count, num, &replace) > 0) {
|
if (pcre_get_substring(field_data, ovector, match_count, num, &replace) >= 0) {
|
||||||
|
if (replace) {
|
||||||
switch_size_t r;
|
switch_size_t r;
|
||||||
|
|
||||||
for (r = 0; r < strlen(replace) && y < (len - 1); r++) {
|
for (r = 0; r < strlen(replace) && y < (len - 1); r++) {
|
||||||
substituted[y++] = replace[r];
|
substituted[y++] = replace[r];
|
||||||
}
|
}
|
||||||
pcre_free_substring(replace);
|
pcre_free_substring(replace);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
substituted[y++] = data[x];
|
substituted[y++] = data[x];
|
||||||
x++;
|
x++;
|
||||||
@ -200,12 +203,14 @@ SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, c
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < match_count; i++) {
|
for (i = 0; i < match_count; i++) {
|
||||||
if (pcre_get_substring(field_data, ovector, match_count, i, &replace) > 0) {
|
if (pcre_get_substring(field_data, ovector, match_count, i, &replace) >= 0) {
|
||||||
|
if (replace) {
|
||||||
callback(var, replace, user_data);
|
callback(var, replace, user_data);
|
||||||
pcre_free_substring(replace);
|
pcre_free_substring(replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial)
|
SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user