Skip to content

Commit

Permalink
statistics: do not allow duplicate stats in different groups
Browse files Browse the repository at this point in the history
The statistic's name should be unique, whether it is located in a
different group or not.

Completes 4640465, Fixes #3136
  • Loading branch information
razvancrainea committed Oct 4, 2023
1 parent 483ee0b commit e7f887d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/statistics/statistics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,17 @@ static unsigned long get_stat_series(struct stat_series *ss)

static struct stat_series *new_stat_series(struct stat_series_profile *profile, str *name)
{
struct stat_series *ss = shm_malloc(sizeof *ss + name->len + 1 +
struct stat_series *ss;

/* we should first check whether there is an overlapping statistic with
* this name, since we are not allowed to have that
*/
if (get_stat(name)) {
LM_DBG("%.*s stat already exists!\n", name->len, name->s);
return NULL;
}

ss = shm_malloc(sizeof *ss + name->len + 1 +
profile->slots * sizeof (*ss->slots));
if (!ss) {
LM_ERR("could not allocate new stat series!\n");
Expand Down

0 comments on commit e7f887d

Please sign in to comment.