Initialize pcap using an empty array instead of NULL. So no special
authortuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 28 May 2011 12:48:21 +0000 (12:48 +0000)
committertuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 28 May 2011 12:48:21 +0000 (12:48 +0000)
check is needed.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37445 f5534014-38df-0310-8fa8-9805f1628bb7

dumpcap.c

index 1ca5a3654f1a449460c521f12724a88c661b6a4f..c1176574dbd550a0b714f268b500e1a1e5721c6c 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -3043,7 +3043,6 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
 #ifdef SIGINFO
     global_ld.report_packet_count = FALSE;
 #endif
-    global_ld.pcaps               = g_array_new(FALSE, FALSE, sizeof(pcap_options *));
     if (capture_opts->has_autostop_packets)
         global_ld.packet_max      = capture_opts->autostop_packets;
     else
@@ -3482,12 +3481,10 @@ static void capture_loop_stop(void)
     guint i;
     pcap_options *pcap_opts;
 
-    if (global_ld.pcaps) {
-        for (i = 0; i < global_ld.pcaps->len; i++) {
-            pcap_opts = g_array_index(global_ld.pcaps, pcap_options *, i);
-            if (pcap_opts->pcap_h != NULL)
-                pcap_breakloop(pcap_opts->pcap_h);
-        }
+    for (i = 0; i < global_ld.pcaps->len; i++) {
+        pcap_opts = g_array_index(global_ld.pcaps, pcap_options *, i);
+        if (pcap_opts->pcap_h != NULL)
+            pcap_breakloop(pcap_opts->pcap_h);
     }
 #endif
     global_ld.go = FALSE;
@@ -3818,7 +3815,7 @@ main(int argc, char *argv[])
                       console_log_handler, NULL /* user_data */);
 
     /* Initialize the pcaps list */
-    global_ld.pcaps = NULL;
+    global_ld.pcaps = g_array_new(FALSE, FALSE, sizeof(pcap_options *));
 
     /* Initialize the thread system */
     if (!g_thread_supported())