aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dcerpc-nt.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-28 16:02:45 -0700
committerMichael Mann <mmann78@netscape.net>2015-07-03 23:35:14 +0000
commit126e02cd58c08aa234cd8c9e0e0739f961f462d3 (patch)
treebc095aa1d1b9e575bdcbef49bfe017e0725b64ab /epan/dissectors/packet-dcerpc-nt.c
parent80f7ee063d371f0de989d51d40c6b4fabfbfb430 (diff)
Call reassembly_table_destroy and move g_hash_table_destroy
This patch moves g_hash_table_destroy calls from the init routine to the cleanup routine. Besides that, the conditional check for the hash table has been removed, assuming that init is always paired with a cleanup call. If reassembly_table_init is found, a reassembly_table_destroy call is prepended to the cleanup function as well. Comments have been removed from the init function as well as these did not seem to have additional value ("destroy hash table" is clear from the context). The changes were automatically generated using https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=4d11f07180d9c115eb14bd860e9a47d82d3d1dcd Manually edited files (for assignment auditing): dvbci, ositp, sccp, tcp. Other files that needed special attention due to the use of register_postseq_cleanup_routine: - ipx: keep call, do not add another cleanup routine. - ncp: remove empty mncp_postseq_cleanup. mncp_hash_lookup is used even if a frame is visited before (see dissect_ncp_common), hence the hash table cannot be destroyed here. Do it in cleanup instead. - ndps: add cleanup routine to kill reassembly table, but do not destroy the hash table as it is already done in ndps_postseq_cleanup. Change-Id: I95a72b3df2978b2c13fefff6bd6821442193d0ed Reviewed-on: https://code.wireshark.org/review/9223 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-dcerpc-nt.c')
-rw-r--r--epan/dissectors/packet-dcerpc-nt.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c
index 2f463288e8..5a6b6a4087 100644
--- a/epan/dissectors/packet-dcerpc-nt.c
+++ b/epan/dissectors/packet-dcerpc-nt.c
@@ -870,18 +870,14 @@ gboolean dcerpc_fetch_polhnd_data(e_ctx_hnd *policy_hnd,
static void init_pol_hash(void)
{
- /* Initialise hash table */
-
- if (pol_hash) {
- /* Everything in the table is allocated with wmem file
- * scope so there's no need to go through and free it all.
- */
- g_hash_table_destroy(pol_hash);
- }
-
pol_hash = g_hash_table_new(pol_hash_fn, pol_hash_compare);
}
+static void cleanup_pol_hash(void)
+{
+ g_hash_table_destroy(pol_hash);
+}
+
/* Dissect a NT status code */
int
@@ -2025,6 +2021,7 @@ void dcerpc_smb_init(int proto_dcerpc)
expert_dcerpc_nt = expert_register_protocol(proto_dcerpc);
expert_register_field_array(expert_dcerpc_nt, ei, array_length(ei));
register_init_routine(&init_pol_hash);
+ register_cleanup_routine(&cleanup_pol_hash);
}
/*