diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-06-28 15:15:07 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-07-03 23:37:40 +0000 |
commit | ba9aa3015f29f07bf81cdfebdfab54fdc379b94d (patch) | |
tree | abe1a58ac119d8c64fe9656221aa2e3bcfe0034d /epan/dissectors/packet-dcerpc.c | |
parent | ea46cf4f73c72bf343a5d07ba33166d696a3d1f6 (diff) |
Split more init routines into init/cleanup functions
This patch is partially automatically generated, but are modified
manually. In particular, assignments and function calls have been
audited.
Some debugging comments and ifdef'd prints have been removed. The
lookup tables of the dcm and sip dissectors are now cleared. It is only
called on reopening files anyway.
The isakmp dissector is modified to use g_hash_table_new_full for
destruction of its keys and values.
Fix a memleak in ipsec dissector when libgcrypt is not enabled.
Generated using
https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=3c6128ee266024d164650955f93c7740484abd68
(with AUDIT = True).
Change-Id: I3fd910bdee663842ac0196334fe0189b67e251b0
Reviewed-on: https://code.wireshark.org/review/9225
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-dcerpc.c')
-rw-r--r-- | epan/dissectors/packet-dcerpc.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 46bca0bfce..695aa4484b 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -6097,33 +6097,26 @@ static void dcerpc_init_protocol(void) { /* structures and data for BIND */ - if (dcerpc_binds) { - g_hash_table_destroy(dcerpc_binds); - dcerpc_binds = NULL; - } - if (!dcerpc_binds) { - dcerpc_binds = g_hash_table_new(dcerpc_bind_hash, dcerpc_bind_equal); - } + dcerpc_binds = g_hash_table_new(dcerpc_bind_hash, dcerpc_bind_equal); /* structures and data for CALL */ - if (dcerpc_cn_calls) { - g_hash_table_destroy(dcerpc_cn_calls); - } dcerpc_cn_calls = g_hash_table_new(dcerpc_cn_call_hash, dcerpc_cn_call_equal); - if (dcerpc_dg_calls) { - g_hash_table_destroy(dcerpc_dg_calls); - } dcerpc_dg_calls = g_hash_table_new(dcerpc_dg_call_hash, dcerpc_dg_call_equal); /* structure and data for MATCHED */ - if (dcerpc_matched) { - g_hash_table_destroy(dcerpc_matched); - } dcerpc_matched = g_hash_table_new(dcerpc_matched_hash, dcerpc_matched_equal); - decode_dcerpc_inject_bindings(); } +static void +dcerpc_cleanup_protocol(void) +{ + g_hash_table_destroy(dcerpc_binds); + g_hash_table_destroy(dcerpc_cn_calls); + g_hash_table_destroy(dcerpc_dg_calls); + g_hash_table_destroy(dcerpc_matched); +} + void proto_register_dcerpc(void) { @@ -6521,6 +6514,7 @@ proto_register_dcerpc(void) expert_register_field_array(expert_dcerpc, ei, array_length(ei)); register_init_routine(dcerpc_init_protocol); + register_cleanup_routine(dcerpc_cleanup_protocol); dcerpc_module = prefs_register_protocol(proto_dcerpc, NULL); prefs_register_bool_preference(dcerpc_module, "desegment_dcerpc", |