diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-10-05 12:33:13 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-10-05 17:26:06 +0200 |
commit | dfd044930689aa6d2af94d15d1372923c5302ffb (patch) | |
tree | 7ad9cc59c2d54c76c6b08d813f93d7730f0b45e7 /examples/c-collectd/c-collectd.c | |
parent | 07f2c2d9cc7e29b53de42c3849bc3c2e6b6b8fb9 (diff) |
Fix issues detected by SonarCloud.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/c-collectd/c-collectd.c')
-rw-r--r-- | examples/c-collectd/c-collectd.c | 5 |
1 files changed, 2 insertions, 3 deletions
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)); } } } |