Change in libosmocore[master]: Make rate_ctr_group_free() more robust

Max gerrit-no-reply at lists.osmocom.org
Mon Mar 18 14:42:19 UTC 2019


Max has uploaded this change for review. ( https://gerrit.osmocom.org/13303


Change subject: Make rate_ctr_group_free() more robust
......................................................................

Make rate_ctr_group_free() more robust

Properly check and handle empty or NULL input.

Change-Id: I859a91ee4400b3685c05971f8c66bceca6758724
---
M src/rate_ctr.c
1 file changed, 5 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/03/13303/1

diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 75302da..b76d687 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -255,8 +255,11 @@
 /*! Free the memory for the specified group of counters */
 void rate_ctr_group_free(struct rate_ctr_group *grp)
 {
-	llist_del(&grp->list);
-	talloc_free(grp);
+	if (grp) {
+		if (!llist_empty(&grp->list))
+			llist_del(&grp->list);
+		talloc_free(grp);
+	}
 }
 
 /*! Add a number to the counter */

-- 
To view, visit https://gerrit.osmocom.org/13303
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I859a91ee4400b3685c05971f8c66bceca6758724
Gerrit-Change-Number: 13303
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190318/0346a279/attachment.html>


More information about the gerrit-log mailing list