Skip to content

Commit

Permalink
regex: allocate pcres array
Browse files Browse the repository at this point in the history
- GH #3812

(cherry picked from commit 2cc6213)
  • Loading branch information
miconda committed Apr 25, 2024
1 parent eaacc17 commit c8f6853
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/modules/regex/regex_mod.c
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 c8f6853

Please sign in to comment.