capture_info: Fix initialization of packet counter
g_hash_table_destroy will crash, if it is called on non-initialized memory. For some reason, this does not happen with other glib lists (e.g. GList seems to guard cleanly). This change initializes at the earliest possible time the packet counter hash with NULL Change-Id: Ice66652fc9639d10b49d006ecbe80efe3f41e2ff Reviewed-on: https://code.wireshark.org/review/12841 Reviewed-by: Roland Knall <rknall@gmail.com> Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
parent
0285fb9e21
commit
35ee09e0f0
3
tshark.c
3
tshark.c
|
@ -2564,6 +2564,9 @@ capture(void)
|
|||
fflush(stderr);
|
||||
g_string_free(str, TRUE);
|
||||
|
||||
/* initialize the counts hash with null */
|
||||
global_info_data.counts.counts_hash = NULL;
|
||||
|
||||
ret = sync_pipe_start(&global_capture_opts, &global_capture_session, &global_info_data, NULL);
|
||||
|
||||
if (!ret)
|
||||
|
|
|
@ -3181,6 +3181,9 @@ main(int argc, char *argv[])
|
|||
/* the window can be sized only, if it's not already shown, so do it now! */
|
||||
main_load_window_geometry(top_level);
|
||||
|
||||
/* initialize the packet counters */
|
||||
global_info_data.counts.counts_hash = NULL;
|
||||
|
||||
g_timeout_add(info_update_freq, resolv_update_cb, NULL);
|
||||
|
||||
/* If we were given the name of a capture file, read it in now;
|
||||
|
|
|
@ -612,6 +612,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
plugin_if_register_gui_cb(PLUGIN_IF_PREFERENCE_SAVE, plugin_if_mainwindow_preference);
|
||||
plugin_if_register_gui_cb(PLUGIN_IF_GOTO_FRAME, plugin_if_mainwindow_gotoframe);
|
||||
|
||||
/* Initialize packet counter */
|
||||
info_data_.counts.counts_hash = NULL;
|
||||
|
||||
main_ui_->mainStack->setCurrentWidget(main_welcome_);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue