aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/circuit.c16
-rw-r--r--epan/circuit.h1
-rw-r--r--epan/conversation.c19
-rw-r--r--epan/conversation.h1
-rw-r--r--epan/epan.c15
-rw-r--r--epan/epan.h2
-rw-r--r--epan/expert.c10
-rw-r--r--epan/expert.h2
-rw-r--r--epan/packet.c27
-rw-r--r--epan/reassemble.c22
-rw-r--r--epan/reassemble.h7
-rw-r--r--epan/reassemble_test.c36
-rw-r--r--epan/stream.c91
-rw-r--r--epan/stream.h3
-rw-r--r--file.c20
-rw-r--r--rawshark.c2
-rw-r--r--tshark.c10
17 files changed, 188 insertions, 96 deletions
diff --git a/epan/circuit.c b/epan/circuit.c
index 73dbbce2c6..7228fd5f42 100644
--- a/epan/circuit.c
+++ b/epan/circuit.c
@@ -74,16 +74,24 @@ circuit_match(gconstpointer v, gconstpointer w)
}
/*
- * Initialize some variables every time a file is loaded or re-loaded.
- * Destroy all existing circuits, and create a new hash table
- * for the circuits in the new file.
+ * Destroy all existing circuits.
*/
void
-circuit_init(void)
+circuit_cleanup(void)
{
if (circuit_hashtable != NULL)
g_hash_table_destroy(circuit_hashtable);
+ circuit_hashtable = NULL;
+}
+
+/*
+ * Initialize some variables every time a file is loaded or re-loaded.
+ * Create a new hash table for the circuits in the new file.
+ */
+void
+circuit_init(void)
+{
/*
* Free up any space allocated for circuit protocol data
* areas.
diff --git a/epan/circuit.h b/epan/circuit.h
index 1271706a33..cd262b1318 100644
--- a/epan/circuit.h
+++ b/epan/circuit.h
@@ -51,6 +51,7 @@ typedef struct circuit {
circuit_key *key_ptr; /* pointer to the key for this circuit */
} circuit_t;
+extern void circuit_cleanup(void);
extern void circuit_init(void);
extern circuit_t *circuit_new(circuit_type ctype, guint32 circuit_id,
diff --git a/epan/conversation.c b/epan/conversation.c
index 3f0fac3126..76dd0ef3fa 100644
--- a/epan/conversation.c
+++ b/epan/conversation.c
@@ -409,12 +409,10 @@ conversation_match_no_addr2_or_port2(gconstpointer v, gconstpointer w)
}
/*
- * Initialize some variables every time a file is loaded or re-loaded.
- * Destroy all existing conversations, and create a new hash table
- * for the conversations in the new file.
+ * Destroy all existing conversations
*/
void
-conversation_init(void)
+conversation_cleanup(void)
{
/* The conversation keys are se_ allocated so they are already gone */
conversation_keys = NULL;
@@ -427,6 +425,19 @@ conversation_init(void)
if (conversation_hashtable_no_addr2_or_port2 != NULL)
g_hash_table_destroy(conversation_hashtable_no_addr2_or_port2);
+ conversation_hashtable_exact = NULL;
+ conversation_hashtable_no_addr2 = NULL;
+ conversation_hashtable_no_port2 = NULL;
+ conversation_hashtable_no_addr2_or_port2 = NULL;
+}
+
+/*
+ * Initialize some variables every time a file is loaded or re-loaded.
+ * Create a new hash table for the conversations in the new file.
+ */
+void
+conversation_init(void)
+{
/*
* Free up any space allocated for conversation protocol data
* areas.
diff --git a/epan/conversation.h b/epan/conversation.h
index cb44ba7137..7c4418c68c 100644
--- a/epan/conversation.h
+++ b/epan/conversation.h
@@ -77,6 +77,7 @@ typedef struct conversation {
conversation_key *key_ptr; /* pointer to the key for this conversation */
} conversation_t;
+extern void conversation_cleanup(void);
extern void conversation_init(void);
extern conversation_t *conversation_new(guint32 setup_frame, address *addr1, address *addr2,
diff --git a/epan/epan.c b/epan/epan.c
index e7df854334..048695b51a 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -117,8 +117,7 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da
void
epan_cleanup(void)
{
- se_free_all();
- expert_cleanup();
+ cleanup_dissection();
dfilter_cleanup();
proto_cleanup();
prefs_cleanup();
@@ -139,11 +138,23 @@ epan_conversation_init(void)
}
void
+epan_conversation_cleanup(void)
+{
+ conversation_cleanup();
+}
+
+void
epan_circuit_init(void)
{
circuit_init();
}
+void
+epan_circuit_cleanup(void)
+{
+ circuit_cleanup();
+}
+
epan_dissect_t*
epan_dissect_init(epan_dissect_t *edt, gboolean create_proto_tree, gboolean proto_tree_visible)
{
diff --git a/epan/epan.h b/epan/epan.h
index 35c20c15ef..759d0fbd6f 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -53,6 +53,7 @@ void epan_cleanup(void);
* value indicating to which flow the packet belongs.
*/
void epan_conversation_init(void);
+void epan_conversation_cleanup(void);
/*
* Initialize the table of circuits. Circuits are identified by a
@@ -65,6 +66,7 @@ void epan_conversation_init(void);
* code.
*/
void epan_circuit_init(void);
+void epan_circuit_cleanup(void);
/* A client will create one epan_t for an entire dissection session.
* A single epan_t will be used to analyze the entire sequence of packets,
diff --git a/epan/expert.c b/epan/expert.c
index bd66d8daaf..0b25440f16 100644
--- a/epan/expert.c
+++ b/epan/expert.c
@@ -68,8 +68,6 @@ const value_string expert_severity_vals[] = {
{ 0, NULL }
};
-
-
void
expert_init(void)
{
@@ -77,10 +75,10 @@ expert_init(void)
{ &hf_expert_msg,
{ "Message", "expert.message", FT_STRING, BASE_NONE, NULL, 0, "Wireshark expert information", HFILL }
},
- { &hf_expert_group,
+ { &hf_expert_group,
{ "Group", "expert.group", FT_UINT32, BASE_NONE, VALS(expert_group_vals), 0, "Wireshark expert group", HFILL }
},
- { &hf_expert_severity,
+ { &hf_expert_severity,
{ "Severity level", "expert.severity", FT_UINT32, BASE_NONE, VALS(expert_severity_vals), 0, "Wireshark expert severity level", HFILL }
}
};
@@ -118,7 +116,7 @@ expert_get_highest_severity(void)
}
-/* set's the PI_ flags to a protocol item
+/* set's the PI_ flags to a protocol item
* (and it's parent items till the toplevel) */
static void
expert_set_item_flags(proto_item *pi, int group, int severity)
@@ -138,7 +136,7 @@ expert_create_tree(proto_item *pi, int group, int severity, const char *msg)
proto_item *ti;
tree = proto_item_add_subtree(pi, ett_expert);
- ti = proto_tree_add_protocol_format(tree, proto_expert, NULL, 0, 0, "Expert Info (%s/%s): %s",
+ ti = proto_tree_add_protocol_format(tree, proto_expert, NULL, 0, 0, "Expert Info (%s/%s): %s",
val_to_str(severity, expert_severity_vals, "?%u?"),
val_to_str(group, expert_group_vals, "?%u?"),
msg);
diff --git a/epan/expert.h b/epan/expert.h
index dfa5172136..4b89b45cc0 100644
--- a/epan/expert.h
+++ b/epan/expert.h
@@ -1,7 +1,7 @@
/* expert.h
* Collecting of Expert information.
*
- * For further info, see: http://wiki.wireshark.org/Development/ExpertInfo
+ * For further info, see: http://wiki.wireshark.org/Development/ExpertInfo
*
* $Id$
*
diff --git a/epan/packet.c b/epan/packet.c
index 249310da89..82d78ccb1c 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -142,7 +142,7 @@ init_dissection(void)
/* Initialize the common data structures for fragment reassembly.
Must be done *after* calling init routines, as those routines
may free up space for fragments, which they find by using the
- data structures that "reassemble_init()" frees. */
+ data structures that "reassemble_cleanup()" frees. */
reassemble_init();
/* Initialize the stream-handling tables */
@@ -155,7 +155,30 @@ init_dissection(void)
void
cleanup_dissection(void)
{
- init_dissection();
+ /* Reclaim all memory of seasonal scope */
+ se_free_all();
+
+ /* Cleanup the table of conversations. */
+ epan_conversation_cleanup();
+
+ /* Cleanup the table of circuits. */
+ epan_circuit_cleanup();
+
+ /* TODO: Introduce cleanup_routines */
+ /* Cleanup protocol-specific variables. */
+ g_slist_foreach(init_routines, &call_init_routine, NULL);
+
+ /* Cleanup the common data structures for fragment reassembly.
+ Must be done *after* calling init routines, as those routines
+ may free up space for fragments, which they find by using the
+ data structures that "reassemble_cleanup()" frees. */
+ reassemble_cleanup();
+
+ /* Cleanup the stream-handling tables */
+ stream_cleanup();
+
+ /* Initialize the expert infos */
+ expert_cleanup();
}
/* Allow protocols to register a "cleanup" routine to be
diff --git a/epan/reassemble.c b/epan/reassemble.c
index 1fec1398db..f1ff411ccf 100644
--- a/epan/reassemble.c
+++ b/epan/reassemble.c
@@ -205,7 +205,7 @@ reassembled_hash(gconstpointer k)
/*
* For a fragment hash table entry, free the address data to which the key
* refers and the fragment data to which the value refers.
- * (The actual key and value structures get freed by "reassemble_init()".)
+ * (The actual key and value structures get freed by "reassemble_cleanup()".)
*/
static gboolean
free_all_fragments(gpointer key_arg, gpointer value, gpointer user_data _U_)
@@ -260,7 +260,7 @@ static fragment_data *new_head(guint32 flags)
/*
* For a reassembled-packet hash table entry, free the fragment data
* to which the value refers.
- * (The actual value structures get freed by "reassemble_init()".)
+ * (The actual value structures get freed by "reassemble_cleanup()".)
*/
static gboolean
free_all_reassembled_fragments(gpointer key_arg _U_, gpointer value,
@@ -298,7 +298,7 @@ fragment_table_init(GHashTable **fragment_table)
*
* Remove all entries and free fragment data for
* each entry. (The key and value data is freed
- * by "reassemble_init()".)
+ * by "reassemble_cleanup()".)
*/
g_hash_table_foreach_remove(*fragment_table,
free_all_fragments, NULL);
@@ -318,7 +318,7 @@ dcerpc_fragment_table_init(GHashTable **fragment_table)
*
* Remove all entries and free fragment data for
* each entry. (The key and value data is freed
- * by "reassemble_init()".)
+ * by "reassemble_cleanup()".)
*/
g_hash_table_foreach_remove(*fragment_table,
free_all_fragments, NULL);
@@ -341,7 +341,7 @@ reassembled_table_init(GHashTable **reassembled_table)
*
* Remove all entries and free reassembled packet
* data for each entry. (The key data is freed
- * by "reassemble_init()".)
+ * by "reassemble_cleanup()".)
*/
g_hash_table_foreach_remove(*reassembled_table,
free_all_reassembled_fragments, NULL);
@@ -357,7 +357,7 @@ reassembled_table_init(GHashTable **reassembled_table)
* reassembled keys.
*/
void
-reassemble_init(void)
+reassemble_cleanup(void)
{
#if GLIB_CHECK_VERSION(2,10,0)
#else
@@ -366,6 +366,16 @@ reassemble_init(void)
if (fragment_data_chunk != NULL)
g_mem_chunk_destroy(fragment_data_chunk);
+ fragment_key_chunk = NULL;
+ fragment_data_chunk = NULL;
+#endif
+}
+
+void
+reassemble_init(void)
+{
+#if GLIB_CHECK_VERSION(2,10,0)
+#else
fragment_key_chunk = g_mem_chunk_new("fragment_key_chunk",
sizeof(fragment_key),
fragment_init_count * sizeof(fragment_key),
diff --git a/epan/reassemble.h b/epan/reassemble.h
index 396c7d52d7..10453010f2 100644
--- a/epan/reassemble.h
+++ b/epan/reassemble.h
@@ -114,6 +114,11 @@ extern void reassembled_table_init(GHashTable **reassembled_table);
/*
* Free up all space allocated for fragment keys and data.
*/
+void reassemble_cleanup(void);
+
+/*
+ * Initialise fragment keys and data.
+ */
void reassemble_init(void);
/*
@@ -226,7 +231,7 @@ fragment_add_seq_next(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
guint32 frag_data_len, gboolean more_frags);
extern void
-fragment_start_seq_check(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
+fragment_start_seq_check(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
guint32 tot_len);
extern fragment_data *
diff --git a/epan/reassemble_test.c b/epan/reassemble_test.c
index 828726a215..765e398eee 100644
--- a/epan/reassemble_test.c
+++ b/epan/reassemble_test.c
@@ -58,7 +58,7 @@ int failure = 0;
void do_test(int condition, char *format, ...)
{
va_list ap;
-
+
if(condition)
return;
va_start(ap, format);
@@ -266,7 +266,7 @@ static void test_fragment_add_seq_partial_reassembly(void)
fd_head=fragment_get(&pinfo,12,fragment_table);
ASSERT_NE(NULL,fd_head);
-
+
/* check the contents of the structure */
ASSERT_EQ(0,fd_head->frame); /* unused */
ASSERT_EQ(0,fd_head->offset); /* unused */
@@ -298,7 +298,7 @@ static void test_fragment_add_seq_partial_reassembly(void)
pinfo.fd->num = 3;
fd_head=fragment_add_seq(tvb, 0, &pinfo, 12, fragment_table,
1, 40, TRUE);
-
+
ASSERT_EQ(1,g_hash_table_size(fragment_table));
ASSERT_EQ(NULL,fd_head);
fd_head=fragment_get(&pinfo,12,fragment_table);
@@ -336,16 +336,16 @@ static void test_fragment_add_seq_partial_reassembly(void)
ASSERT_NE(NULL,fd->data);
ASSERT_EQ(NULL,fd->next);
-
+
/* have another go at wrapping things up */
pinfo.fd->num = 4;
fd_head=fragment_add_seq(tvb, 20, &pinfo, 12, fragment_table,
2, 100, FALSE);
-
+
ASSERT_EQ(1,g_hash_table_size(fragment_table));
ASSERT_NE(NULL,fd_head);
-
+
/* check the contents of the structure */
ASSERT_EQ(0,fd_head->frame); /* unused */
ASSERT_EQ(0,fd_head->offset); /* unused */
@@ -371,7 +371,7 @@ static void test_fragment_add_seq_partial_reassembly(void)
ASSERT_EQ(0,fd->flags);
ASSERT_EQ(NULL,fd->data);
ASSERT_NE(NULL,fd->next);
-
+
fd=fd->next;
ASSERT_EQ(3,fd->frame);
ASSERT_EQ(1,fd->offset); /* seqno */
@@ -473,12 +473,12 @@ static void test_fragment_add_seq_partial_reassembly(void)
static void test_fragment_add_dcerpc_dg(void)
{
e_uuid_t act_id = {1,2,3,{4,5,6,7,8,9,10,11}};
-
+
fragment_data *fd_head, *fdh0;
GHashTable *fragment_table = NULL;
printf("Starting test test_fragment_add_dcerpc_dg\n");
-
+
/* we need our own fragment table */
dcerpc_fragment_table_init(&fragment_table);
fd_head=fragment_add_dcerpc_dg(tvb, 10, &pinfo, 12, &act_id, fragment_table,
@@ -573,7 +573,7 @@ static void test_fragment_add_seq_check_work(
ASSERT_EQ(2,g_hash_table_size(fragment_table));
ASSERT_EQ(0,g_hash_table_size(reassembled_table));
ASSERT_EQ(NULL,fd_head);
-
+
/* add the terminal fragment of the first datagram */
pinfo.fd->num = 3;
fd_head=fn(tvb, 5, &pinfo, 12, fragment_table,
@@ -779,8 +779,8 @@ static void test_simple_fragment_add_seq_next(void)
ASSERT_EQ(2,g_hash_table_size(fragment_table));
ASSERT_EQ(0,g_hash_table_size(reassembled_table));
ASSERT_EQ(NULL,fd_head);
-
-
+
+
/* now we add the terminal fragment of the first datagram */
pinfo.fd->num = 3;
fd_head=fragment_add_seq_next(tvb, 5, &pinfo, 12, fragment_table,
@@ -1015,15 +1015,15 @@ int main(int argc, char **argv)
test_missing_data_fragment_add_seq_next_2,
test_missing_data_fragment_add_seq_next_3
};
-
+
/* we don't use our params */
argc=argc; argv=argv;
-
+
/* initialise stuff */
ep_init_chunk();
tvbuff_init();
reassemble_init();
-
+
/* a tvbuff for testing with */
data = g_malloc(DATA_LEN);
/* make sure it's full of stuff */
@@ -1043,12 +1043,12 @@ int main(int argc, char **argv)
/* re-init the fragment tables */
fragment_table_init(&fragment_table);
ASSERT(fragment_table != NULL);
-
+
reassembled_table_init(&reassembled_table);
ASSERT(reassembled_table != NULL);
pinfo.fd->flags.visited = FALSE;
-
+
tests[i]();
}
@@ -1100,7 +1100,7 @@ void col_add_fstr(column_info *cinfo _U_, gint col _U_, const gchar *format _U_,
...)
{}
-
+
diff --git a/epan/stream.c b/epan/stream.c
index 2122d0f49d..7bd0852dda 100644
--- a/epan/stream.c
+++ b/epan/stream.c
@@ -117,7 +117,7 @@ gboolean stream_compare_func(gconstpointer a,
if( key1 -> p2p_dir != key2 -> p2p_dir ||
key1-> is_circuit != key2 -> is_circuit )
return FALSE;
-
+
if( key1 -> is_circuit )
return (key1 -> circ.circuit == key2 -> circ.circuit );
else
@@ -133,23 +133,26 @@ static GMemChunk *streams = NULL;
static GHashTable *stream_hash;
-/* init/reset function, call from stream_init() */
-static void init_stream_hash( void ) {
- if( stream_hash != NULL ) {
- g_hash_table_destroy( stream_hash );
+/* cleanup reset function, call from stream_cleanup() */
+static void cleanup_stream_hash( void ) {
+ if( stream_hash != NULL ) {
+ g_hash_table_destroy( stream_hash );
stream_hash = NULL;
- }
+ }
- if( stream_keys != NULL ) {
- g_mem_chunk_destroy( stream_keys );
+ if( stream_keys != NULL ) {
+ g_mem_chunk_destroy( stream_keys );
stream_keys = NULL;
- }
+ }
- if( streams != NULL ) {
- g_mem_chunk_destroy( streams );
+ if( streams != NULL ) {
+ g_mem_chunk_destroy( streams );
streams = NULL;
- }
+ }
+}
+/* init function, call from stream_init() */
+static void init_stream_hash( void ) {
streams = g_mem_chunk_create(stream_t,
MEMCHUNK_STREAM_COUNT,
G_ALLOC_ONLY);
@@ -162,7 +165,6 @@ static void init_stream_hash( void ) {
stream_compare_func);
}
-
/* lookup function, returns null if not found */
static stream_t *stream_hash_lookup_circ( const struct circuit *circuit, int p2p_dir )
{
@@ -186,7 +188,7 @@ static stream_t *stream_hash_lookup_conv( const struct conversation *conv, int p
static stream_t *new_stream( stream_key_t *key )
{
stream_t *val;
-
+
val = g_mem_chunk_alloc(streams);
val -> key = key;
val -> pdu_counter = 0;
@@ -234,14 +236,16 @@ static GMemChunk *pdus = NULL;
/* pdu counter, for generating unique pdu ids */
static guint32 pdu_counter;
-
-static void stream_init_pdu_data(void)
+static void stream_cleanup_pdu_data(void)
{
if( pdus != NULL ) {
g_mem_chunk_destroy( pdus );
pdus = NULL;
}
+}
+static void stream_init_pdu_data(void)
+{
pdus = g_mem_chunk_create(stream_pdu_t,
MEMCHUNK_PDU_COUNT,
G_ALLOC_ONLY);
@@ -290,7 +294,7 @@ gboolean fragment_compare_func(gconstpointer a,
key1 -> framenum == key2 -> framenum &&
key1 -> offset == key2 -> offset );
}
-
+
/* memory pools */
static GMemChunk *fragment_keys = NULL;
static GMemChunk *fragment_vals = NULL;
@@ -299,27 +303,30 @@ static GMemChunk *fragment_vals = NULL;
static GHashTable *fragment_hash;
-/* init/reset function, call from stream_init() */
-static void init_fragment_hash( void ) {
- if( fragment_hash != NULL ) {
- g_hash_table_destroy( fragment_hash );
- fragment_hash = NULL;
- }
+/* cleanup function, call from stream_cleanup() */
+static void cleanup_fragment_hash( void ) {
+ if( fragment_hash != NULL ) {
+ g_hash_table_destroy( fragment_hash );
+ fragment_hash = NULL;
+ }
- if( fragment_vals != NULL ) {
- g_mem_chunk_destroy( fragment_vals );
- fragment_vals = NULL;
- }
+ if( fragment_vals != NULL ) {
+ g_mem_chunk_destroy( fragment_vals );
+ fragment_vals = NULL;
+ }
- if( fragment_keys != NULL ) {
- g_mem_chunk_destroy( fragment_keys );
- fragment_keys = NULL;
- }
+ if( fragment_keys != NULL ) {
+ g_mem_chunk_destroy( fragment_keys );
+ fragment_keys = NULL;
+ }
+}
+/* init function, call from stream_init() */
+static void init_fragment_hash( void ) {
fragment_keys = g_mem_chunk_create(fragment_key_t,
MEMCHUNK_FRAGMENT_COUNT,
G_ALLOC_ONLY);
-
+
fragment_vals = g_mem_chunk_create(stream_pdu_fragment_t,
MEMCHUNK_FRAGMENT_COUNT,
G_ALLOC_ONLY);
@@ -383,7 +390,7 @@ stream_t *stream_new_circ ( const struct circuit *circuit, int p2p_dir )
DISSECTOR_ASSERT( stream == NULL );
stream = stream_hash_insert_circ(circuit, p2p_dir);
-
+
return stream;
}
@@ -416,6 +423,13 @@ stream_t *find_stream_conv ( const struct conversation *conv, int p2p_dir )
return stream_hash_lookup_conv(conv,p2p_dir);
}
+/* cleanup the stream routines */
+void stream_cleanup( void )
+{
+ cleanup_stream_hash();
+ cleanup_fragment_hash();
+ stream_cleanup_pdu_data();
+}
/* initialise the stream routines */
void stream_init( void )
@@ -428,16 +442,13 @@ void stream_init( void )
reassembled_table_init(&stream_reassembled_table);
}
-
-
-
/*****************************************************************************/
stream_pdu_fragment_t *stream_find_frag( stream_t *stream, guint32 framenum, guint32 offset )
{
return fragment_hash_lookup( stream, framenum, offset );
}
-
+
stream_pdu_fragment_t *stream_add_frag( stream_t *stream, guint32 framenum, guint32 offset,
tvbuff_t *tvb, packet_info *pinfo, gboolean more_frags )
{
@@ -457,7 +468,7 @@ stream_pdu_fragment_t *stream_add_frag( stream_t *stream, guint32 framenum, guin
/* start a new pdu */
pdu = stream->current_pdu = stream_new_pdu(stream);
}
-
+
/* add it to the reassembly tables */
fd_head = fragment_add_seq_next(tvb, 0, pinfo, pdu->id,
stream_fragment_table, stream_reassembled_table,
@@ -470,7 +481,7 @@ stream_pdu_fragment_t *stream_add_frag( stream_t *stream, guint32 framenum, guin
/* if this was the last fragment, update the pdu data.
*/
pdu -> fd_head = fd_head;
-
+
/* start a new pdu next time */
stream->current_pdu = NULL;
@@ -509,7 +520,7 @@ tvbuff_t *stream_process_reassembled(
return process_reassembled_data(tvb, offset, pinfo, name, pdu->fd_head,
fit, update_col_infop, tree);
}
-
+
guint32 stream_get_frag_length( const stream_pdu_fragment_t *frag)
{
DISSECTOR_ASSERT( frag );
diff --git a/epan/stream.h b/epan/stream.h
index aeb18e4cc1..a7e50f7523 100644
--- a/epan/stream.h
+++ b/epan/stream.h
@@ -80,7 +80,7 @@ extern stream_t *find_stream_conv ( const struct conversation *conv, int p2p_dir
/* see if we've seen this fragment before.
-
+
The framenum and offset are just hash keys, so can be any values unique
to this frame, but the idea is that you use the number of the frame being
disassembled, and the byte-offset within that frame.
@@ -134,5 +134,6 @@ extern guint32 stream_get_pdu_no( const stream_pdu_fragment_t *frag);
/* initialise the stream routines */
void stream_init( void );
+void stream_cleanup( void );
#endif /* STREAM_H */
diff --git a/file.c b/file.c
index eccf1a3c84..2a2f29cb78 100644
--- a/file.c
+++ b/file.c
@@ -246,6 +246,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
and fill in the information for this file. */
cf_reset_state(cf);
+ /* Cleanup all data structures used for dissection. */
+ cleanup_dissection();
/* Initialize all data structures used for dissection. */
init_dissection();
@@ -285,7 +287,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
#if GLIB_CHECK_VERSION(2,10,0)
#else
- /* memory chunks have been deprecated in favor of the slice allocator,
+ /* memory chunks have been deprecated in favor of the slice allocator,
* which has been added in 2.10
*/
cf->plist_chunk = g_mem_chunk_new("frame_data_chunk",
@@ -344,7 +346,7 @@ cf_reset_state(capture_file *cf)
if (cf->plist != NULL)
g_slice_free_chain(frame_data, cf->plist, next);
#else
- /* memory chunks have been deprecated in favor of the slice allocator,
+ /* memory chunks have been deprecated in favor of the slice allocator,
* which has been added in 2.10
*/
if (cf->plist_chunk != NULL) {
@@ -424,7 +426,7 @@ static void compute_elapsed(GTimeVal *start_time)
GTimeVal time_now;
g_get_current_time(&time_now);
-
+
delta_time = (time_now.tv_sec - start_time->tv_sec) * 1e6 +
time_now.tv_usec - start_time->tv_usec;
@@ -432,7 +434,7 @@ static void compute_elapsed(GTimeVal *start_time)
}
static float calc_progbar_val(capture_file *cf, gint64 size, gint64 file_pos){
-
+
float progbar_val;
progbar_val = (gfloat) file_pos / (gfloat) size;
@@ -628,7 +630,7 @@ cf_read(capture_file *cf)
* don't need after the sequential run-through of the packets. */
postseq_cleanup_all_protocols();
- /* compute the time it took to load the file */
+ /* compute the time it took to load the file */
compute_elapsed(&start_time);
/* Set the file encapsulation type now; we don't know what it is until
@@ -1229,8 +1231,8 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
frame_data *plist_end;
int row = -1;
- /* Allocate the next list entry, and add it to the list.
- * memory chunks have been deprecated in favor of the slice allocator,
+ /* Allocate the next list entry, and add it to the list.
+ * memory chunks have been deprecated in favor of the slice allocator,
* which has been added in 2.10
*/
#if GLIB_CHECK_VERSION(2,10,0)
@@ -1297,7 +1299,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
a G_ALLOC_ONLY chunk and read in a huge capture file, it didn't
seem to save a noticeable amount of time or space. */
#if GLIB_CHECK_VERSION(2,10,0)
- /* memory chunks have been deprecated in favor of the slice allocator,
+ /* memory chunks have been deprecated in favor of the slice allocator,
* which has been added in 2.10
*/
g_slice_free(frame_data,fdata);
@@ -1716,6 +1718,8 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
want to dissect those before their time. */
cf->redissecting = TRUE;
+ /* Cleanup all data structures used for dissection. */
+ cleanup_dissection();
/* Initialize all data structures used for dissection. */
init_dissection();
diff --git a/rawshark.c b/rawshark.c
index 97e0de4f7d..3249e4f326 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -1599,6 +1599,8 @@ raw_cf_open(capture_file *cf, const char *fname)
/* The open succeeded. Fill in the information for this file. */
+ /* Cleanup all data structures used for dissection. */
+ cleanup_dissection();
/* Initialize all data structures used for dissection. */
init_dissection();
diff --git a/tshark.c b/tshark.c
index 1d0b5dcf5e..05194a1091 100644
--- a/tshark.c
+++ b/tshark.c
@@ -668,13 +668,13 @@ tshark_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
{
/* ignore log message, if log_level isn't interesting based
upon the console log preferences.
- If the preferences haven't been loaded loaded yet, display the
+ If the preferences haven't been loaded loaded yet, display the
message anyway.
- The default console_log_level preference value is such that only
+ The default console_log_level preference value is such that only
ERROR, CRITICAL and WARNING level messages are processed;
MESSAGE, INFO and DEBUG level messages are ignored.
-
+
XXX: Aug 07, 2009: Prior tshark g_log code was hardwired to process only
ERROR and CRITICAL level messages so the current code is a behavioral
change. The current behavior is the same as in Wireshark.
@@ -1832,6 +1832,8 @@ capture(void)
relinquish_special_privs_perm();
print_current_user();
+ /* Cleanup all data structures used for dissection. */
+ cleanup_dissection();
/* Initialize all data structures used for dissection. */
init_dissection();
@@ -3144,6 +3146,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
/* The open succeeded. Fill in the information for this file. */
+ /* Cleanup all data structures used for dissection. */
+ cleanup_dissection();
/* Initialize all data structures used for dissection. */
init_dissection();