In ICMP taps, don't use g_slist_insert_sorted (which results in
[metze/wireshark/wip.git] / ui / cli / tap-icmpstat.c
index a39236091210fa9870328c6a546db08ff229636d..39c0c10e96849105dd0e79fd77f716b49cc9e9d5 100644 (file)
@@ -128,7 +128,7 @@ icmpstat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_,
         if (rt == NULL)
             return 0;
         *rt = resp_time;
-        icmpstat->rt_list = g_slist_insert_sorted(icmpstat->rt_list, rt, compare_doubles);
+        icmpstat->rt_list = g_slist_prepend(icmpstat->rt_list, rt);
         icmpstat->num_resps++;
         if (icmpstat->min_msecs > resp_time) {
             icmpstat->min_frame = trans->resp_frame;
@@ -153,10 +153,13 @@ icmpstat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_,
  */
 static void compute_stats(icmpstat_t *icmpstat, double *mean, double *med, double *sdev)
 {
-    GSList *slist = icmpstat->rt_list;
+    GSList *slist;
     double diff;
     double sq_diff_sum = 0.0;
 
+    icmpstat->rt_list = g_slist_sort(icmpstat->rt_list, compare_doubles);
+    slist = icmpstat->rt_list;
+
     if (icmpstat->num_resps == 0 || slist == NULL) {
         *mean = 0.0;
         *med = 0.0;