Module: kamailio
Branch: 4.2
Commit: b8268aff60a023bfcd188f4c2e57fb3ba9b00138
URL:
https://github.com/kamailio/kamailio/commit/b8268aff60a023bfcd188f4c2e57fb3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-19T09:35:25+02:00
regex: replaced allocated memory initialization with a for loop to one memset
(cherry picked from commit abdc02f1cb26c71b4118044d8c45dec728992e15)
---
Modified: modules/regex/regex_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b8268aff60a023bfcd188f4c2e57fb3…
Patch:
https://github.com/kamailio/kamailio/commit/b8268aff60a023bfcd188f4c2e57fb3…
---
diff --git a/modules/regex/regex_mod.c b/modules/regex/regex_mod.c
index 4f714b5..adc0de9 100644
--- a/modules/regex/regex_mod.c
+++ b/modules/regex/regex_mod.c
@@ -281,9 +281,8 @@ static int load_pcres(int action)
fclose(f);
goto err;
}
- for (i=0; i<max_groups; i++) {
- patterns[i] = NULL;
- }
+ memset(patterns, 0, sizeof(char*) * max_groups);
+
for (i=0; i<max_groups; i++) {
if ((patterns[i] = pkg_malloc(sizeof(char) * group_max_size)) == 0) {
LM_ERR("no more memory for patterns[%d]\n", i);