aboutsummaryrefslogtreecommitdiffstats
path: root/src/rate_ctr.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-03-18 15:41:26 +0100
committerHarald Welte <laforge@gnumonks.org>2019-03-19 12:57:10 +0000
commitfb6f43ee0c6a288e036ca616a29f6b7485d426c6 (patch)
tree02534439581fd1ab9710c0d175162dd4656b46ca /src/rate_ctr.c
parentd488c7256fee60902fbef8bfeac211664769d63f (diff)
rate_ctr_group_free(): guard against empty or NULL input
Diffstat (limited to 'src/rate_ctr.c')
-rw-r--r--src/rate_ctr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 75302da2..c9319a6f 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -255,7 +255,11 @@ struct rate_ctr_group *rate_ctr_group_alloc(void *ctx,
/*! Free the memory for the specified group of counters */
void rate_ctr_group_free(struct rate_ctr_group *grp)
{
- llist_del(&grp->list);
+ if (!grp)
+ return;
+
+ if (!llist_empty(&grp->list))
+ llist_del(&grp->list);
talloc_free(grp);
}