aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2021-06-23 12:17:21 +0200
committerLuca Deri <deri@ntop.org>2021-06-23 12:17:21 +0200
commit6a1fd9ad97e6226bb4d186762fefa50737270c52 (patch)
tree525d76cf87ee0079b3b27c81d6ad55132f09668e /example/ndpiReader.c
parent2234b97149b4a7a9dcdc5d04e0e25b36f6360532 (diff)
Added missing check to prevent crashes
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c5
1 files changed, 4 insertions, 1 deletions
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];