Zero stat table elements instead of freeing them.
authorGerald Combs <gerald@wireshark.org>
Tue, 4 Aug 2015 04:25:00 +0000 (21:25 -0700)
committerGerald Combs <gerald@wireshark.org>
Tue, 4 Aug 2015 16:14:22 +0000 (16:14 +0000)
Stat table element arrays are allocated once at startup. Reset each
element in free_stat_table() instead of freeing them.

Change-Id: Ia63af93c76a1348bbb809137a521eead58a52dd1
Reviewed-on: https://code.wireshark.org/review/9860
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
epan/stat_tap_ui.c

index c038c58592f8485216bdf45773b282a33f41a5f9..3f8a15f4580c7c49b78927b3a699ca9513fe0455 100644 (file)
@@ -274,11 +274,8 @@ void free_stat_table(new_stat_tap_ui* new_stat, new_stat_tap_gui_free_cb gui_cal
                 if (new_stat->stat_tap_free_table_item_cb)
                     new_stat->stat_tap_free_table_item_cb(stat_table, element, field_index, field_data);
             }
-
-            g_free(stat_table->elements[element]);
+            memset(stat_table->elements[i], 0, sizeof(field_data) * stat_table->num_fields);
         }
-
-        g_free(stat_table->elements);
     }
 }