kamailio: backport and move to PCRE2
[feed/telephony.git] / net / kamailio / patches / 032-regex-convert-to-memory-error-logging-helper.patch
1 From 5c7de00bc0826cf739577010ba7b4882e83819cc Mon Sep 17 00:00:00 2001
2 From: Victor Seva <linuxmaniac@torreviejawireless.org>
3 Date: Wed, 9 Aug 2023 10:52:47 +0000
4 Subject: [PATCH] regex: convert to memory error logging helper
5
6 ---
7 src/modules/regex/regex_mod.c | 8 ++++----
8 1 file changed, 4 insertions(+), 4 deletions(-)
9
10 --- a/src/modules/regex/regex_mod.c
11 +++ b/src/modules/regex/regex_mod.c
12 @@ -198,13 +198,13 @@ static int mod_init(void)
13
14 /* Pointer to pcres */
15 if((pcres_addr = shm_malloc(sizeof(pcre **))) == 0) {
16 - LM_ERR("no memory for pcres_addr\n");
17 + SHM_MEM_ERROR;
18 goto err;
19 }
20
21 /* Integer containing the number of pcres */
22 if((num_pcres = shm_malloc(sizeof(int))) == 0) {
23 - LM_ERR("no memory for num_pcres\n");
24 + SHM_MEM_ERROR;
25 goto err;
26 }
27
28 @@ -425,14 +425,14 @@ static int load_pcres(int action)
29 shm_free(pcres);
30 }
31 if((pcres = shm_malloc(sizeof(pcre *) * num_pcres_tmp)) == 0) {
32 - LM_ERR("no more memory for pcres\n");
33 + SHM_MEM_ERROR;
34 goto err;
35 }
36 memset(pcres, 0, sizeof(pcre *) * num_pcres_tmp);
37 for(i = 0; i < num_pcres_tmp; i++) {
38 pcre_rc = pcre_fullinfo(pcres_tmp[i], NULL, PCRE_INFO_SIZE, &pcre_size);
39 if((pcres[i] = shm_malloc(pcre_size)) == 0) {
40 - LM_ERR("no more memory for pcres[%i]\n", i);
41 + SHM_MEM_ERROR;
42 goto err;
43 }
44 memcpy(pcres[i], pcres_tmp[i], pcre_size);