diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-10-24 18:35:24 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-10-24 16:46:33 +0000 |
commit | b48e82ca9eee93ccd821cd179951837bf7a22d6a (patch) | |
tree | db5eaaee8edfc28da7585fe1337f391d679bb2c1 /src | |
parent | cbf5cdfe7eb10e6efee16cbd6b5e7b910f8c47a7 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/rate_ctr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rate_ctr.c b/src/rate_ctr.c index 6de59a02..296cc16e 100644 --- a/src/rate_ctr.c +++ b/src/rate_ctr.c @@ -74,12 +74,13 @@ static void *tall_rate_ctr_ctx; 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); |