summaryrefslogtreecommitdiff
path: root/epan/packet.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-08-11 13:42:12 +0000
committerEvan Huus <eapache@gmail.com>2013-08-11 13:42:12 +0000
commit83d31621fb15b41f34710bdb4c7dd43142cae30a (patch)
tree56871a000fa0484df48f6add54f383df36d7e062 /epan/packet.c
parent1176e2f3d7ee1db073eb6d6bcf02ca52d1f66765 (diff)
downloadwireshark-83d31621fb15b41f34710bdb4c7dd43142cae30a.tar.gz
Free a few hash tables in packet.c when we shutdown.
svn path=/trunk/; revision=51292
Diffstat (limited to 'epan/packet.c')
-rw-r--r--epan/packet.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/epan/packet.c b/epan/packet.c
index a4c5f2b4f4..cdf9cb96c9 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -70,6 +70,44 @@ struct data_source {
char *name;
};
+/*
+ * A dissector table.
+ *
+ * "hash_table" is a hash table, indexed by port number, supplying
+ * a "struct dtbl_entry"; it records what dissector is assigned to
+ * that uint or string value in that table.
+ *
+ * "dissector_handles" is a list of all dissectors that *could* be
+ * used in that table; not all of them are necessarily in the table,
+ * as they may be for protocols that don't have a fixed uint value,
+ * e.g. for TCP or UDP port number tables and protocols with no fixed
+ * port number.
+ *
+ * "ui_name" is the name the dissector table has in the user interface.
+ *
+ * "type" is a field type giving the width of the uint value for that
+ * dissector table, if it's a uint dissector table.
+ *
+ * "base" is the base in which to display the uint value for that
+ * dissector table, if it's a uint dissector table.
+ */
+struct dissector_table {
+ GHashTable *hash_table;
+ GSList *dissector_handles;
+ const char *ui_name;
+ ftenum_t type;
+ int base;
+};
+
+static GHashTable *dissector_tables = NULL;
+
+/*
+ * List of registered dissectors.
+ */
+static GHashTable *registered_dissectors = NULL;
+
+static GHashTable *heur_dissector_lists = NULL;
+
void
packet_init(void)
{
@@ -86,7 +124,9 @@ packet_init(void)
void
packet_cleanup(void)
{
- /* nothing */
+ g_hash_table_destroy(dissector_tables);
+ g_hash_table_destroy(registered_dissectors);
+ g_hash_table_destroy(heur_dissector_lists);
}
/*
@@ -663,37 +703,6 @@ struct dtbl_entry {
dissector_handle_t current;
};
-/*
- * A dissector table.
- *
- * "hash_table" is a hash table, indexed by port number, supplying
- * a "struct dtbl_entry"; it records what dissector is assigned to
- * that uint or string value in that table.
- *
- * "dissector_handles" is a list of all dissectors that *could* be
- * used in that table; not all of them are necessarily in the table,
- * as they may be for protocols that don't have a fixed uint value,
- * e.g. for TCP or UDP port number tables and protocols with no fixed
- * port number.
- *
- * "ui_name" is the name the dissector table has in the user interface.
- *
- * "type" is a field type giving the width of the uint value for that
- * dissector table, if it's a uint dissector table.
- *
- * "base" is the base in which to display the uint value for that
- * dissector table, if it's a uint dissector table.
- */
-struct dissector_table {
- GHashTable *hash_table;
- GSList *dissector_handles;
- const char *ui_name;
- ftenum_t type;
- int base;
-};
-
-static GHashTable *dissector_tables = NULL;
-
/* Finds a dissector table by table name. */
dissector_table_t
find_dissector_table(const char *name)
@@ -1627,9 +1636,6 @@ get_dissector_table_base(const char *name)
return sub_dissectors->base;
}
-static GHashTable *heur_dissector_lists = NULL;
-
-
/* Finds a heuristic dissector table by table name. */
static heur_dissector_list_t *
find_heur_dissector_list(const char *name)
@@ -1896,11 +1902,6 @@ register_heur_dissector_list(const char *name, heur_dissector_list_t *sub_dissec
* of dissectors until one likes the packet".
*/
-/*
- * List of registered dissectors.
- */
-static GHashTable *registered_dissectors = NULL;
-
/* Get the long name of the protocol for a dissector handle, if it has
a protocol. */
const char *