From 0347538758f29b056c2e04959539bdc32f0291b6 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 18 Feb 2018 12:52:21 -0800 Subject: Don't start command-line taps until we've opened a file. We shouldn't do so until we have something on which to compute statistics and until we're in file scope, as the taps may use file-scoped memory, given that statistics pertain to a file. Change-Id: I08b6e5ed145d7a25056857cc570f383f5116d6ce Reviewed-on: https://code.wireshark.org/review/25889 Reviewed-by: Guy Harris --- tfshark.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tfshark.c') diff --git a/tfshark.c b/tfshark.c index d6dc4ebd7b..5e91c90139 100644 --- a/tfshark.c +++ b/tfshark.c @@ -878,11 +878,6 @@ main(int argc, char *argv[]) line that their preferences have changed. */ prefs_apply_all(); - /* At this point MATE will have registered its field array so we can - have a tap filter with one of MATE's late-registered fields as part - of the filter. We can now process all the "-z" arguments. */ - start_requested_stats(); - /* * Enabled and disabled protocols and heuristic dissectors as per * command-line options. @@ -958,6 +953,14 @@ main(int argc, char *argv[]) goto clean_exit; } + /* Start statistics taps; we do so after successfully opening the + capture file, so we know we have something to compute stats + on, and after registering all dissectors, so that MATE will + have registered its field array so we can have a tap filter + with one of MATE's late-registered fields as part of the + filter. */ + start_requested_stats(); + /* Process the packets in the file */ TRY { /* XXX - for now there is only 1 packet */ -- cgit v1.2.3