aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ieee802154.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-28 15:15:07 +0200
committerMichael Mann <mmann78@netscape.net>2015-07-03 23:37:40 +0000
commitba9aa3015f29f07bf81cdfebdfab54fdc379b94d (patch)
treeabe1a58ac119d8c64fe9656221aa2e3bcfe0034d /epan/dissectors/packet-ieee802154.c
parentea46cf4f73c72bf343a5d07ba33166d696a3d1f6 (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-ieee802154.c')
-rw-r--r--epan/dissectors/packet-ieee802154.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 944d6e6589..f115d4c18c 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -2381,22 +2381,22 @@ proto_init_ieee802154(void)
{
guint i;
- /* Destroy hash tables, if they exist. */
- if (ieee802154_map.short_table)
- g_hash_table_destroy(ieee802154_map.short_table);
- if (ieee802154_map.long_table)
- g_hash_table_destroy(ieee802154_map.long_table);
-
- /* Create the hash tables. */
ieee802154_map.short_table = g_hash_table_new(ieee802154_short_addr_hash, ieee802154_short_addr_equal);
ieee802154_map.long_table = g_hash_table_new(ieee802154_long_addr_hash, ieee802154_long_addr_equal);
- /* Re-load the hash table from the static address UAT. */
+ /* Reload the hash table from the static address UAT. */
for (i=0; (i<num_static_addrs) && (static_addrs); i++) {
ieee802154_addr_update(&ieee802154_map,(guint16)static_addrs[i].addr16, (guint16)static_addrs[i].pan,
pntoh64(static_addrs[i].eui64), ieee802154_user, IEEE802154_USER_MAPPING);
} /* for */
} /* proto_init_ieee802154 */
+static void
+proto_cleanup_ieee802154(void)
+{
+ g_hash_table_destroy(ieee802154_map.short_table);
+ g_hash_table_destroy(ieee802154_map.long_table);
+}
+
/* Returns the prompt string for the Decode-As dialog. */
static void ieee802154_da_prompt(packet_info *pinfo _U_, gchar* result)
{
@@ -2765,6 +2765,7 @@ void proto_register_ieee802154(void)
/* Register the init routine. */
register_init_routine(proto_init_ieee802154);
+ register_cleanup_routine(proto_cleanup_ieee802154);
/* Register Protocol name and description. */
proto_ieee802154 = proto_register_protocol("IEEE 802.15.4 Low-Rate Wireless PAN", "IEEE 802.15.4",