aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-giop.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-28 07:35:00 -0700
committerMichael Mann <mmann78@netscape.net>2015-07-03 23:36:37 +0000
commit7ce77c69ea4f3424616558729ec23cf3dd1de694 (patch)
treebf3310cb4eb6fccb7dcc29297ef49732a108bdc9 /epan/dissectors/packet-giop.c
parentf5340b2a07a0a5f6830a091283d3170195203b82 (diff)
Split four more init routines into init/cleanup
Three of them are trivial movements, the smb-sidsnooping is an odd one. Ronnie Sahlberg disabled the sid_name_snooping feature on 9 July 2007. There is a preference to override it though... For now add a TODO marker and ensure that the hash tables are always initialized. Change-Id: I61f5e215c9fa72a6785fb48eaa2d50c1975d7483 Reviewed-on: https://code.wireshark.org/review/9227 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-giop.c')
-rw-r--r--epan/dissectors/packet-giop.c52
1 files changed, 8 insertions, 44 deletions
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c
index 92f12ed1dc..ffb4b55cad 100644
--- a/epan/dissectors/packet-giop.c
+++ b/epan/dissectors/packet-giop.c
@@ -1593,58 +1593,21 @@ static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) {
*/
static void giop_init(void) {
-
-
- /*
- * Create objkey/repoid hash, use my "equal" and "hash" functions.
- * Note: keys and values are wmem_file_scoped so they don't need to be freed.
- *
- */
-
- if (giop_objkey_hash)
- g_hash_table_destroy(giop_objkey_hash);
-
- /*
- * Create hash, use my "equal" and "hash" functions.
- *
- */
-
giop_objkey_hash = g_hash_table_new(giop_hash_objkey_hash, giop_hash_objkey_equal);
-
-
- /*
- * Create complete_reply_hash, use my "equal" and "hash" functions.
- * Note: keys and values are wmem_file_scoped so they don't need to be freed.
- *
- */
-
- if (giop_complete_reply_hash)
- g_hash_table_destroy(giop_complete_reply_hash);
-
- /*
- * Create hash, use my "equal" and "hash" functions.
- *
- */
-
giop_complete_reply_hash = g_hash_table_new(complete_reply_hash_fn, complete_reply_equal_fn);
-
- /*
- * Free giop_complete_request_list (if necessary)
- * Note: The data elements are wmem_file_scoped so only the
- * actual list elements need to be freed.
- */
-
- if (giop_complete_request_list) {
- g_list_free(giop_complete_request_list);
- giop_complete_request_list = NULL;
- }
-
+ giop_complete_request_list = NULL;
read_IOR_strings_from_file(giop_ior_file, 600);
reassembly_table_init(&giop_reassembly_table,
&addresses_reassembly_table_functions);
+}
+static void giop_cleanup(void) {
+ reassembly_table_destroy(&giop_reassembly_table);
+ g_hash_table_destroy(giop_objkey_hash);
+ g_hash_table_destroy(giop_complete_reply_hash);
+ g_list_free(giop_complete_request_list);
}
@@ -5560,6 +5523,7 @@ proto_register_giop (void)
/* register init routine */
register_init_routine( &giop_init); /* any init stuff */
+ register_cleanup_routine( &giop_cleanup);
/* Register for tapping */
giop_tap = register_tap(GIOP_TAP_NAME); /* GIOP statistics tap */