aboutsummaryrefslogtreecommitdiffstats
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
parenttests: use -no-install libtool flag to avoid ./lt-* scripts (diff)
downloadlibosmocore-fb6f43ee0c6a288e036ca616a29f6b7485d426c6.tar.xz
libosmocore-fb6f43ee0c6a288e036ca616a29f6b7485d426c6.zip
rate_ctr_group_free(): guard against empty or NULL input
Change-Id: I859a91ee4400b3685c05971f8c66bceca6758724
-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);
}