summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2015-08-18 08:11:34 +0100
committerAnders Broman <a.broman58@gmail.com>2015-08-25 07:28:35 +0000
commitce246a6b64540d18f61e396df639213914c2421b (patch)
tree959a65cdd985a637d9326d4c51b8f747870dcb47
parent52dadc75bf626a3d135ed11e0065a275555d5a08 (diff)
downloadwireshark-ce246a6b64540d18f61e396df639213914c2421b.tar.gz
[GTK] Fix crash in comparestat.c
Selecting a row in the statistics table causes a Glib assertion failure. GLib:ERROR:ghash.c:373:g_hash_table_lookup_node: assertion failed: (hash_table->ref_count > 0) When the comparestat_draw() function is called, the cs->ip_id_set hash table is created and then immediately destroyed, but the hash table lookup to cs->ip_id_set in new_tree_view_selection_changed() can happen anytime the user clicks on a table row. Bug: 11098 Change-Id: I6c7a39c947ca11327c3fc3ab0d4caa735798d142 Reviewed-on: https://code.wireshark.org/review/10096 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> (cherry picked from commit 9c331f73b5be7cde6b04b6cb68cf73deb4bdc4ce) Reviewed-on: https://code.wireshark.org/review/10193 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/gtk/compare_stat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/gtk/compare_stat.c b/ui/gtk/compare_stat.c
index 3b70075b3a..e3ed636278 100644
--- a/ui/gtk/compare_stat.c
+++ b/ui/gtk/compare_stat.c
@@ -524,6 +524,7 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data)
gtk_tree_store_clear(cs->simple_list);
g_hash_table_destroy(cs->packet_set);
g_hash_table_destroy(cs->nr_set);
+ g_hash_table_destroy(cs->ip_id_set);
g_free(cs);
}
@@ -563,7 +564,6 @@ comparestat_draw(void *arg)
return;
}
- cs->ip_id_set=g_hash_table_new(NULL, NULL);
g_hash_table_foreach(cs->packet_set, call_foreach_count_ip_id, cs);
/* set up TTL choice if only one number found */
@@ -616,7 +616,6 @@ comparestat_draw(void *arg)
}
g_hash_table_foreach(cs->ip_id_set, call_foreach_print_ip_tree, cs);
- g_hash_table_destroy(cs->ip_id_set);
g_string_free(filter_str, TRUE);
g_array_free(cs->ip_ttl_list, TRUE);
}
@@ -792,12 +791,15 @@ gtk_comparestat_init(const char *opt_arg, void* userdata _U_)
/* create a Hash to count the packets with the same ip.id */
cs->packet_set=g_hash_table_new(NULL, NULL);
+ cs->ip_id_set=g_hash_table_new(NULL, NULL);
+
error_string=register_tap_listener("ip", cs, filter, 0, comparestat_reset, comparestat_packet, comparestat_draw);
if(error_string){
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
g_string_free(error_string, TRUE);
gtk_tree_store_clear(cs->simple_list);
g_hash_table_destroy(cs->packet_set);
+ g_hash_table_destroy(cs->ip_id_set);
g_free(cs);
return;
}