From dfd044930689aa6d2af94d15d1372923c5302ffb Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Thu, 5 Oct 2023 12:33:13 +0200 Subject: Fix issues detected by SonarCloud. Signed-off-by: Toni Uhlig --- examples/c-collectd/c-collectd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples/c-collectd/c-collectd.c') diff --git a/examples/c-collectd/c-collectd.c b/examples/c-collectd/c-collectd.c index 30e8da553..3f8e2aef0 100644 --- a/examples/c-collectd/c-collectd.c +++ b/examples/c-collectd/c-collectd.c @@ -726,7 +726,7 @@ static enum nDPIsrvd_callback_return collectd_json_callback(struct nDPIsrvd_sock struct nDPIsrvd_json_token const * current = NULL; int next_child_index = -1; - if (flow_risk != NULL) + if (flow_risk != NULL && flow_user_data != NULL) { if (flow_user_data->detected_risks == 0) { @@ -744,13 +744,12 @@ static enum nDPIsrvd_callback_return collectd_json_callback(struct nDPIsrvd_sock if (numeric_risk_value < NDPI_MAX_RISK && numeric_risk_value > 0) { collectd_statistics.flow_risk_count[numeric_risk_value - 1]++; + flow_user_data->detected_risks |= (1ull << (numeric_risk_value - 1)); } else { collectd_statistics.flow_risk_unknown_count++; } - - flow_user_data->detected_risks |= (1ull << (numeric_risk_value - 1)); } } } -- cgit v1.2.3