From 7c0c580c4b0093437ee81e11934ef5b8d27a5bb4 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Sat, 4 Feb 2017 16:26:34 +0100 Subject: wiretap: add cleanup routine. The cleanup routine has been added to exit section of the applications. Those which required a exit restyle have been patched as well. Change-Id: I3a8787f0718ac7fef00dc58176869c7510fda7b1 Reviewed-on: https://code.wireshark.org/review/19949 Petri-Dish: Dario Lombardo Reviewed-by: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo --- wiretap/wtap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'wiretap/wtap.c') diff --git a/wiretap/wtap.c b/wiretap/wtap.c index e14953b624..6473d43ee9 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -936,6 +936,13 @@ static void wtap_init_encap_types(void) { g_array_append_vals(encap_table_arr,encap_table_base,wtap_num_encap_types); } +static void wtap_cleanup_encap_types(void) { + if (encap_table_arr) { + g_array_free(encap_table_arr, TRUE); + encap_table_arr = NULL; + } +} + int wtap_get_num_encap_types(void) { return wtap_num_encap_types; } @@ -1428,6 +1435,17 @@ wtap_init(void) #endif } +/* + * Cleanup the library + */ +void +wtap_cleanup(void) +{ + wtap_cleanup_encap_types(); + wtap_opttypes_cleanup(); + ws_buffer_cleanup(); +} + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * -- cgit v1.2.1