summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-dcerpc.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-28 15:15:07 +0200
committerPeter Wu <peter@lekensteyn.nl>2015-07-03 23:54:44 +0200
commit9d814a2b3fac3c7694fa75c7d7b77d24de6315dc (patch)
treecc650a4d891a4edc631bb1d4f767ae6c7f41bdc8 /epan/dissectors/packet-dcerpc.c
parent62b279fcaf9ccb0e348a456abd47d6e7338a765e (diff)
downloadwireshark-9d814a2b3fac3c7694fa75c7d7b77d24de6315dc.tar.gz
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
Diffstat (limited to 'epan/dissectors/packet-dcerpc.c')
-rw-r--r--epan/dissectors/packet-dcerpc.c28
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",