Browse code

regex: replaced allocated memory initialization with a for loop to one memset

(cherry picked from commit abdc02f1cb26c71b4118044d8c45dec728992e15)

Daniel-Constantin Mierla authored on 14/05/2015 12:51:06
Showing 1 changed files
... ...
@@ -281,9 +281,8 @@ static int load_pcres(int action)
281 281
 		fclose(f);
282 282
 		goto err;
283 283
 	}
284
-	for (i=0; i<max_groups; i++) {
285
-		patterns[i] = NULL;
286
-	}
284
+	memset(patterns, 0, sizeof(char*) * max_groups);
285
+
287 286
 	for (i=0; i<max_groups; i++) {
288 287
 		if ((patterns[i] = pkg_malloc(sizeof(char) * group_max_size)) == 0) {
289 288
 			LM_ERR("no more memory for patterns[%d]\n", i);