From 3ef14a241afc123560e9a50d17948b040481b299 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 15 Dec 2017 20:19:10 +0100 Subject: 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 --- src/rate_ctr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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); -- cgit v1.2.3