Skip to content

Commit

Permalink
regex: allocate pcres array
Browse files Browse the repository at this point in the history
- GH #3812
  • Loading branch information
miconda committed Apr 23, 2024
1 parent 84517c1 commit 2cc6213
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/modules/regex/regex_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,15 @@ static int load_pcres(int action)
}
shm_free(pcres);
}

if(pcres == NULL) {
if((pcres = shm_malloc(sizeof(pcre2_code *) * num_pcres_tmp)) == 0) {
LM_ERR("no more memory for pcres\n");
goto err;
}
memset(pcres, 0, sizeof(pcre2_code *) * num_pcres_tmp);
}

*num_pcres = num_pcres_tmp;
*pcres = *pcres_tmp;
*pcres_addr = pcres;
Expand Down

0 comments on commit 2cc6213

Please sign in to comment.