dumpcap: Initialize the stats variable

This fixes several "Use of uninitialised value" and "Conditional
jump or move depends on uninitialised value(s)" errors detected by
valgrind.

Change-Id: I682bd4a1d2e5ef23969baf34b3e438fcd7499bd5
Reviewed-on: https://code.wireshark.org/review/32397
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Vasil Velichkov 2019-03-11 19:12:14 +02:00 committed by Peter Wu
parent fb59e45586
commit 7c943d35a2
1 changed files with 1 additions and 6 deletions

View File

@ -4228,11 +4228,6 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
if (pcap_src->pcap_h != NULL) {
g_assert(!pcap_src->from_cap_pipe);
/* Get the capture statistics, so we know how many packets were dropped. */
/*
* Older versions of libpcap didn't set ps_ifdrop on some
* platforms; initialize it to 0 to handle that.
*/
stats->ps_ifdrop = 0;
if (pcap_stats(pcap_src->pcap_h, stats) >= 0) {
*stats_known = TRUE;
/* Let the parent process know. */
@ -4722,7 +4717,7 @@ main(int argc, char *argv[])
gboolean start_capture = TRUE;
gboolean stats_known;
struct pcap_stat stats;
struct pcap_stat stats = {0};
GLogLevelFlags log_flags;
gboolean list_interfaces = FALSE;
int caps_queries = 0;