This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged.
Change subject: rate_ctr: Fix null pointer dereference in error path
......................................................................
rate_ctr: Fix null pointer dereference in error path
In Change-Id Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56 we introduced
a variable de-reference before we check if it's NULL.
Let's reorder the statements to avoid this.
Fixes: Coverity CID#178219
Change-Id: I99265a7ee76f85c479543c19ce8c05ce5d43ae69
---
M src/rate_ctr.c
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 6de59a0..296cc16 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -74,12 +74,13 @@
static bool rate_ctrl_group_desc_validate(const struct rate_ctr_group_desc *desc, bool quiet)
{
unsigned int i;
- const struct rate_ctr_desc *ctr_desc = desc->ctr_desc;
+ const struct rate_ctr_desc *ctr_desc;
if (!desc) {
LOGP(DLGLOBAL, LOGL_ERROR, "NULL is not a valid counter group descriptor\n");
return false;
}
+ ctr_desc = desc->ctr_desc;
DEBUGP(DLGLOBAL, "validating counter group %p(%s) with %u counters\n", desc,
desc->group_name_prefix, desc->num_ctr);
--
To view, visit https://gerrit.osmocom.org/4404
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I99265a7ee76f85c479543c19ce8c05ce5d43ae69
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder