]> git.ipfire.org Git - collecty.git/commitdiff
sources: iptables: Make the static analyzer happy
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Oct 2025 17:58:23 +0000 (17:58 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Oct 2025 17:58:23 +0000 (17:58 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/sources/iptables.c

index 8c90df3aef98a9f4e6963743e2b802cf86801e2f..19fcc10fb0122173654ce8a9253517c358d31cac 100644 (file)
@@ -146,6 +146,11 @@ static int iptables_iterate_matches(td_ctx* ctx, td_source* source,
                if (r < 0)
                        return r;
 
+               // Skip if no comment was found. This will never happen and
+               // is only here to make the static analyzer happy.
+               if (unlikely(!c))
+                       continue;
+
                // Increment counters
                c->packets += rule->counters.pcnt;
                c->bytes   += rule->counters.bcnt;