From 6a1fd9ad97e6226bb4d186762fefa50737270c52 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Wed, 23 Jun 2021 12:17:21 +0200 Subject: Added missing check to prevent crashes --- example/ndpiReader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/example/ndpiReader.c b/example/ndpiReader.c index e04d5b452..b7c2054d9 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -3433,8 +3433,11 @@ void * processing_thread(void *_thread_id) { pcap_loop: runPcapLoop(thread_id); - pcap_close(ndpi_thread_info[thread_id].workflow->pcap_handle); + if(ndpi_thread_info[thread_id].workflow->pcap_handle) + pcap_close(ndpi_thread_info[thread_id].workflow->pcap_handle); + ndpi_thread_info[thread_id].workflow->pcap_handle = NULL; + if(playlist_fp[thread_id] != NULL) { /* playlist: read next file */ char filename[256]; -- cgit v1.2.3