summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-12-15 20:19:10 +0100
committerHarald Welte <laforge@gnumonks.org>2017-12-17 20:12:34 +0000
commit3ef14a241afc123560e9a50d17948b040481b299 (patch)
treef3e74b415dd9a8f232f6bce0e08e3364c59fd3db /src
parent62e40855c2b1b50627dba5b187be8869e2cb2054 (diff)
Do not allocate already existing counter group
Check that no group with the given name and index already exist before allocating it. Add corresponding test case. Change-Id: I563764af1d28043e909234ebb048239125ce6ecd Related: OS#2757
Diffstat (limited to 'src')
-rw-r--r--src/rate_ctr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 477339f2..c27ac68e 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -190,6 +190,9 @@ struct rate_ctr_group *rate_ctr_group_alloc(void *ctx,
unsigned int size;
struct rate_ctr_group *group;
+ if (rate_ctr_get_group_by_name_idx(desc->group_name_prefix, idx))
+ return NULL; /* group already exist */
+
size = sizeof(struct rate_ctr_group) +
desc->num_ctr * sizeof(struct rate_ctr);