From 8987a2c184b6768b577a4a83e69aacb2bf69856c Mon Sep 17 00:00:00 2001 From: Fábio Depin Date: Tue, 24 Jun 2025 10:07:20 -0300 Subject: Fix logic: reset stats once per thread after clearing all flow roots (#2905) Call ndpi_stats_reset() once per thread instead of once per flow root Moved ndpi_stats_reset() outside the loop that destroys ndpi_flows_root[] to avoid redundant resets. The stats structure is shared per thread and should only be reset once after all roots are cleared. --- example/ndpiReader.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'example/ndpiReader.c') diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 4357606fb..f52958e69 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -4935,9 +4935,8 @@ static void ndpi_process_packet(u_char *args, for(i=0; iprefs.num_roots; i++) { ndpi_tdestroy(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], ndpi_flow_info_freer); ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i] = NULL; - - ndpi_stats_reset(&ndpi_thread_info[thread_id].workflow->stats); } + ndpi_stats_reset(&ndpi_thread_info[thread_id].workflow->stats); if(!quiet_mode) printf("\n-------------------------------------------\n\n"); -- cgit v1.2.3