aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-13 01:29:31 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-13 01:29:31 +0000
commit5a1ce3ca3416cdffbac4b231e5fa741ea74ad934 (patch)
tree4c1e67fe96ae22ada16a068ddc90db3ee895673a /epan
parentfd10e62048426651449da31cabeb1787bf7c3a90 (diff)
some more gmemchunk -> se_alloc() updates
there are only 5 gmemchunks left but they have different litetime for their allocations than the 100+ ones that have been removed. The remaining 5 should be converted some other way. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15328 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-acse.c98
-rw-r--r--epan/dissectors/packet-dcerpc-nt.c37
-rw-r--r--epan/dissectors/packet-dcerpc.c83
-rw-r--r--epan/dissectors/packet-iax2.c35
-rw-r--r--epan/dissectors/packet-jxta.c33
-rw-r--r--epan/dissectors/packet-ncp.c19
-rw-r--r--epan/dissectors/packet-ntlmssp.c29
-rw-r--r--epan/dissectors/packet-rpc.c48
-rw-r--r--epan/dissectors/packet-smb-sidsnooping.c26
-rw-r--r--epan/dissectors/packet-smb.c80
-rw-r--r--epan/dissectors/packet-ssh.c26
-rw-r--r--epan/dissectors/packet-wcp.c37
12 files changed, 123 insertions, 428 deletions
diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c
index d65e9396ef..5dbc16b1a7 100644
--- a/epan/dissectors/packet-acse.c
+++ b/epan/dissectors/packet-acse.c
@@ -47,6 +47,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/conversation.h>
#include <stdio.h>
@@ -230,8 +231,6 @@ static guint32 indir_ref=0;
static proto_tree *top_tree=NULL;
/* to keep track of presentation context identifiers and protocol-oids */
-static GMemChunk *acse_ctx_oid_chunk = NULL;
-static int acse_ctx_oid_count = 500;
typedef struct _acse_ctx_oid_t {
/* XXX here we should keep track of ADDRESS/PORT as well */
guint32 ctx_id;
@@ -276,21 +275,13 @@ acse_init(void)
acse_ctx_oid_table = g_hash_table_new(acse_ctx_oid_hash,
acse_ctx_oid_equal);
- if (acse_ctx_oid_chunk) {
- g_mem_chunk_destroy(acse_ctx_oid_chunk);
- acse_ctx_oid_chunk = NULL;
- }
- acse_ctx_oid_chunk = g_mem_chunk_new("acse_ctx_oid_chunk",
- sizeof(acse_ctx_oid_t),
- acse_ctx_oid_count * sizeof(acse_ctx_oid_t),
- G_ALLOC_ONLY);
}
static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
{
acse_ctx_oid_t *aco, *tmpaco;
- aco=g_mem_chunk_alloc(acse_ctx_oid_chunk);
+ aco=se_alloc(sizeof(acse_ctx_oid_t));
aco->ctx_id=idx;
aco->oid=g_strdup(oid);
@@ -300,7 +291,6 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
g_hash_table_remove(acse_ctx_oid_table, tmpaco);
g_free(tmpaco->oid);
tmpaco->oid=NULL;
- g_mem_chunk_free(acse_ctx_oid_chunk, tmpaco);
}
g_hash_table_insert(acse_ctx_oid_table, aco, aco);
}
@@ -424,7 +414,8 @@ static const ber_choice_t T_encoding_choice[] = {
static int
dissect_acse_T_encoding(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- T_encoding_choice, hf_index, ett_acse_T_encoding, NULL);
+ T_encoding_choice, hf_index, ett_acse_T_encoding,
+ NULL);
return offset;
}
@@ -432,6 +423,7 @@ static int dissect_encoding(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
return dissect_acse_T_encoding(FALSE, tvb, offset, pinfo, tree, hf_acse_encoding);
}
+
static const ber_sequence_t EXTERNAL_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_direct_reference },
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_indirect_reference },
@@ -497,6 +489,7 @@ static int dissect_ASO_context_name_list_item(packet_info *pinfo, proto_tree *tr
}
+
static int
dissect_acse_T_aSO_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
@@ -510,6 +503,7 @@ static int dissect_AARQ_aSO_context_name(packet_info *pinfo, proto_tree *tree, t
}
+
static int
dissect_acse_AP_title_form1(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_x509if_Name(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@@ -567,7 +561,8 @@ static const ber_choice_t AP_title_choice[] = {
int
dissect_acse_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- AP_title_choice, hf_index, ett_acse_AP_title, NULL);
+ AP_title_choice, hf_index, ett_acse_AP_title,
+ NULL);
return offset;
}
@@ -582,6 +577,7 @@ static int dissect_responding_AP_title(packet_info *pinfo, proto_tree *tree, tvb
}
+
static int
dissect_acse_ASO_qualifier_form1(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_x509if_RelativeDistinguishedName(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@@ -639,7 +635,8 @@ static const ber_choice_t ASO_qualifier_choice[] = {
static int
dissect_acse_ASO_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- ASO_qualifier_choice, hf_index, ett_acse_ASO_qualifier, NULL);
+ ASO_qualifier_choice, hf_index, ett_acse_ASO_qualifier,
+ NULL);
return offset;
}
@@ -651,6 +648,7 @@ static int dissect_qualifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb
}
+
int
dissect_acse_AE_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_acse_ASO_qualifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@@ -781,6 +779,7 @@ static int dissect_other_mechanism_value(packet_info *pinfo, proto_tree *tree, t
return dissect_acse_T_other_mechanism_value(FALSE, tvb, offset, pinfo, tree, hf_acse_other_mechanism_value);
}
+
static const ber_sequence_t Authentication_value_other_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_other_mechanism_name },
{ BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_other_mechanism_value },
@@ -790,7 +789,7 @@ static const ber_sequence_t Authentication_value_other_sequence[] = {
static int
dissect_acse_Authentication_value_other(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- Authentication_value_other_sequence, hf_index, ett_acse_Authentication_value_other);
+ Authentication_value_other_sequence, hf_index, ett_acse_Authentication_value_other);
return offset;
}
@@ -818,7 +817,8 @@ static const ber_choice_t Authentication_value_choice[] = {
static int
dissect_acse_Authentication_value(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- Authentication_value_choice, hf_index, ett_acse_Authentication_value, NULL);
+ Authentication_value_choice, hf_index, ett_acse_Authentication_value,
+ NULL);
return offset;
}
@@ -925,6 +925,7 @@ static int dissect_transfer_syntaxes(packet_info *pinfo, proto_tree *tree, tvbuf
return dissect_acse_SEQUENCE_OF_TransferSyntaxName(FALSE, tvb, offset, pinfo, tree, hf_acse_transfer_syntaxes);
}
+
static const ber_sequence_t Context_list_item_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pci },
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_abstract_syntax },
@@ -935,7 +936,7 @@ static const ber_sequence_t Context_list_item_sequence[] = {
static int
dissect_acse_Context_list_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- Context_list_item_sequence, hf_index, ett_acse_Context_list_item);
+ Context_list_item_sequence, hf_index, ett_acse_Context_list_item);
return offset;
}
@@ -959,6 +960,7 @@ static int dissect_context_list(packet_info *pinfo, proto_tree *tree, tvbuff_t *
return dissect_acse_Context_list(FALSE, tvb, offset, pinfo, tree, hf_acse_context_list);
}
+
static const ber_sequence_t Default_Context_List_item_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_abstract_syntax_name_impl },
{ BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_transfer_syntax_name_impl },
@@ -968,7 +970,7 @@ static const ber_sequence_t Default_Context_List_item_sequence[] = {
static int
dissect_acse_Default_Context_List_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- Default_Context_List_item_sequence, hf_index, ett_acse_Default_Context_List_item);
+ Default_Context_List_item_sequence, hf_index, ett_acse_Default_Context_List_item);
return offset;
}
@@ -1008,7 +1010,8 @@ static const ber_choice_t Syntactic_context_list_choice[] = {
static int
dissect_acse_Syntactic_context_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- Syntactic_context_list_choice, hf_index, ett_acse_Syntactic_context_list, NULL);
+ Syntactic_context_list_choice, hf_index, ett_acse_Syntactic_context_list,
+ NULL);
return offset;
}
@@ -1032,6 +1035,7 @@ static int dissect_identifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv
return dissect_acse_ASOI_identifier(FALSE, tvb, offset, pinfo, tree, hf_acse_identifier);
}
+
static const ber_sequence_t ASOI_tag_item_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_qualifier },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_identifier },
@@ -1041,7 +1045,7 @@ static const ber_sequence_t ASOI_tag_item_sequence[] = {
static int
dissect_acse_ASOI_tag_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- ASOI_tag_item_sequence, hf_index, ett_acse_ASOI_tag_item);
+ ASOI_tag_item_sequence, hf_index, ett_acse_ASOI_tag_item);
return offset;
}
@@ -1096,6 +1100,7 @@ static int dissect_ABRT_user_information_impl(packet_info *pinfo, proto_tree *tr
return dissect_acse_Association_data(TRUE, tvb, offset, pinfo, tree, hf_acse_ABRT_user_information);
}
+
static const ber_sequence_t AARQ_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_AARQ_protocol_version_impl },
{ BER_CLASS_CON, 1, 0, dissect_AARQ_aSO_context_name },
@@ -1122,7 +1127,7 @@ static const ber_sequence_t AARQ_apdu_sequence[] = {
static int
dissect_acse_AARQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- AARQ_apdu_sequence, hf_index, ett_acse_AARQ_apdu);
+ AARQ_apdu_sequence, hf_index, ett_acse_AARQ_apdu);
return offset;
}
@@ -1148,6 +1153,7 @@ static int dissect_AARE_protocol_version_impl(packet_info *pinfo, proto_tree *tr
}
+
static int
dissect_acse_T_aSO_context_name1(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
@@ -1248,7 +1254,8 @@ static const ber_choice_t Associate_source_diagnostic_choice[] = {
static int
dissect_acse_Associate_source_diagnostic(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- Associate_source_diagnostic_choice, hf_index, ett_acse_Associate_source_diagnostic, NULL);
+ Associate_source_diagnostic_choice, hf_index, ett_acse_Associate_source_diagnostic,
+ NULL);
return offset;
}
@@ -1277,6 +1284,7 @@ static int dissect_Pcontext_result_impl(packet_info *pinfo, proto_tree *tree, tv
}
+
static int
dissect_acse_Concrete_syntax_name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_acse_TransferSyntaxName(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@@ -1308,6 +1316,7 @@ static int dissect_provider_reason_impl(packet_info *pinfo, proto_tree *tree, tv
return dissect_acse_T_provider_reason(TRUE, tvb, offset, pinfo, tree, hf_acse_provider_reason);
}
+
static const ber_sequence_t P_context_result_list_item_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_Pcontext_result_impl },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_concrete_syntax_name_impl },
@@ -1318,7 +1327,7 @@ static const ber_sequence_t P_context_result_list_item_sequence[] = {
static int
dissect_acse_P_context_result_list_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- P_context_result_list_item_sequence, hf_index, ett_acse_P_context_result_list_item);
+ P_context_result_list_item_sequence, hf_index, ett_acse_P_context_result_list_item);
return offset;
}
@@ -1342,6 +1351,7 @@ static int dissect_p_context_result_list_impl(packet_info *pinfo, proto_tree *tr
return dissect_acse_P_context_result_list(TRUE, tvb, offset, pinfo, tree, hf_acse_p_context_result_list);
}
+
static const ber_sequence_t AARE_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_AARE_protocol_version_impl },
{ BER_CLASS_CON, 1, 0, dissect_AARE_aSO_context_name },
@@ -1366,7 +1376,7 @@ static const ber_sequence_t AARE_apdu_sequence[] = {
static int
dissect_acse_AARE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- AARE_apdu_sequence, hf_index, ett_acse_AARE_apdu);
+ AARE_apdu_sequence, hf_index, ett_acse_AARE_apdu);
return offset;
}
@@ -1394,6 +1404,7 @@ static int dissect_RLRQ_reason_impl(packet_info *pinfo, proto_tree *tree, tvbuff
return dissect_acse_Release_request_reason(TRUE, tvb, offset, pinfo, tree, hf_acse_RLRQ_reason);
}
+
static const ber_sequence_t RLRQ_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_RLRQ_reason_impl },
{ BER_CLASS_CON, 13, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_aso_qualifier },
@@ -1405,7 +1416,7 @@ static const ber_sequence_t RLRQ_apdu_sequence[] = {
static int
dissect_acse_RLRQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- RLRQ_apdu_sequence, hf_index, ett_acse_RLRQ_apdu);
+ RLRQ_apdu_sequence, hf_index, ett_acse_RLRQ_apdu);
return offset;
}
@@ -1433,6 +1444,7 @@ static int dissect_RLRE_reason_impl(packet_info *pinfo, proto_tree *tree, tvbuff
return dissect_acse_Release_response_reason(TRUE, tvb, offset, pinfo, tree, hf_acse_RLRE_reason);
}
+
static const ber_sequence_t RLRE_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_RLRE_reason_impl },
{ BER_CLASS_CON, 13, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_aso_qualifier },
@@ -1444,7 +1456,7 @@ static const ber_sequence_t RLRE_apdu_sequence[] = {
static int
dissect_acse_RLRE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- RLRE_apdu_sequence, hf_index, ett_acse_RLRE_apdu);
+ RLRE_apdu_sequence, hf_index, ett_acse_RLRE_apdu);
return offset;
}
@@ -1494,6 +1506,7 @@ static int dissect_abort_diagnostic_impl(packet_info *pinfo, proto_tree *tree, t
return dissect_acse_ABRT_diagnostic(TRUE, tvb, offset, pinfo, tree, hf_acse_abort_diagnostic);
}
+
static const ber_sequence_t ABRT_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_abort_source_impl },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_abort_diagnostic_impl },
@@ -1506,7 +1519,7 @@ static const ber_sequence_t ABRT_apdu_sequence[] = {
static int
dissect_acse_ABRT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- ABRT_apdu_sequence, hf_index, ett_acse_ABRT_apdu);
+ ABRT_apdu_sequence, hf_index, ett_acse_ABRT_apdu);
return offset;
}
@@ -1515,6 +1528,7 @@ static int dissect_abrt_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb
}
+
static int
dissect_acse_User_information(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_acse_Association_data(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@@ -1572,7 +1586,8 @@ static const ber_choice_t T_presentation_data_values_choice[] = {
static int
dissect_acse_T_presentation_data_values(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- T_presentation_data_values_choice, hf_index, ett_acse_T_presentation_data_values, NULL);
+ T_presentation_data_values_choice, hf_index, ett_acse_T_presentation_data_values,
+ NULL);
return offset;
}
@@ -1580,6 +1595,7 @@ static int dissect_presentation_data_values(packet_info *pinfo, proto_tree *tree
return dissect_acse_T_presentation_data_values(FALSE, tvb, offset, pinfo, tree, hf_acse_presentation_data_values);
}
+
static const ber_sequence_t PDV_list_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_transfer_syntax_name },
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_presentation_context_identifier },
@@ -1590,7 +1606,7 @@ static const ber_sequence_t PDV_list_sequence[] = {
static int
dissect_acse_PDV_list(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- PDV_list_sequence, hf_index, ett_acse_PDV_list);
+ PDV_list_sequence, hf_index, ett_acse_PDV_list);
return offset;
}
@@ -1616,7 +1632,8 @@ static const ber_choice_t User_Data_choice[] = {
static int
dissect_acse_User_Data(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- User_Data_choice, hf_index, ett_acse_User_Data, NULL);
+ User_Data_choice, hf_index, ett_acse_User_Data,
+ NULL);
return offset;
}
@@ -1624,6 +1641,7 @@ static int dissect_a_user_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *t
return dissect_acse_User_Data(FALSE, tvb, offset, pinfo, tree, hf_acse_a_user_data);
}
+
static const ber_sequence_t A_DT_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_aso_qualifier },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_asoi_identifier_impl },
@@ -1634,7 +1652,7 @@ static const ber_sequence_t A_DT_apdu_sequence[] = {
static int
dissect_acse_A_DT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- A_DT_apdu_sequence, hf_index, ett_acse_A_DT_apdu);
+ A_DT_apdu_sequence, hf_index, ett_acse_A_DT_apdu);
return offset;
}
@@ -1643,6 +1661,7 @@ static int dissect_adt_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
}
+
static int
dissect_acse_T_aSO_context_name2(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
@@ -1655,6 +1674,7 @@ static int dissect_ACRQ_aSO_context_name_impl(packet_info *pinfo, proto_tree *tr
return dissect_acse_T_aSO_context_name2(TRUE, tvb, offset, pinfo, tree, hf_acse_ACRQ_aSO_context_name);
}
+
static const ber_sequence_t ACRQ_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_aso_qualifier },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_asoi_identifier_impl },
@@ -1668,7 +1688,7 @@ static const ber_sequence_t ACRQ_apdu_sequence[] = {
static int
dissect_acse_ACRQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- ACRQ_apdu_sequence, hf_index, ett_acse_ACRQ_apdu);
+ ACRQ_apdu_sequence, hf_index, ett_acse_ACRQ_apdu);
return offset;
}
@@ -1677,6 +1697,7 @@ static int dissect_acrq_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb
}
+
static int
dissect_acse_T_aSO_context_name3(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
@@ -1689,6 +1710,7 @@ static int dissect_aSO_context_name_impl(packet_info *pinfo, proto_tree *tree, t
return dissect_acse_T_aSO_context_name3(TRUE, tvb, offset, pinfo, tree, hf_acse_aSO_context_name);
}
+
static const ber_sequence_t ACRP_apdu_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_aso_qualifier },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_asoi_identifier_impl },
@@ -1701,7 +1723,7 @@ static const ber_sequence_t ACRP_apdu_sequence[] = {
static int
dissect_acse_ACRP_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- ACRP_apdu_sequence, hf_index, ett_acse_ACRP_apdu);
+ ACRP_apdu_sequence, hf_index, ett_acse_ACRP_apdu);
return offset;
}
@@ -1746,12 +1768,14 @@ static const ber_choice_t ACSE_apdu_choice[] = {
static int
dissect_acse_ACSE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- ACSE_apdu_choice, hf_index, ett_acse_ACSE_apdu, NULL);
+ ACSE_apdu_choice, hf_index, ett_acse_ACSE_apdu,
+ NULL);
return offset;
}
+
static int
dissect_acse_Application_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_acse_ASO_context_name(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@@ -1760,6 +1784,7 @@ dissect_acse_Application_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb,
}
+
static int
dissect_acse_AE_title_form1(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_x509if_Name(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@@ -1799,7 +1824,8 @@ static const ber_choice_t AE_title_choice[] = {
static int
dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
- AE_title_choice, hf_index, ett_acse_AE_title, NULL);
+ AE_title_choice, hf_index, ett_acse_AE_title,
+ NULL);
return offset;
}
diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c
index 2f1eaa45fe..4a19b19980 100644
--- a/epan/dissectors/packet-dcerpc-nt.c
+++ b/epan/dissectors/packet-dcerpc-nt.c
@@ -34,6 +34,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include "packet-dcerpc.h"
#include "packet-dcerpc-nt.h"
#include "packet-windows-common.h"
@@ -411,12 +412,7 @@ typedef struct {
pol_value *list; /* List of policy handle entries */
} pol_hash_value;
-#define POL_HASH_INIT_COUNT 100
-
static GHashTable *pol_hash;
-static GMemChunk *pol_hash_key_chunk;
-static GMemChunk *pol_value_chunk;
-static GMemChunk *pol_hash_value_chunk;
/* Hash function */
@@ -510,10 +506,10 @@ static void add_pol_handle(e_ctx_hnd *policy_hnd, guint32 frame,
* and put the hash value in the policy handle hash
* table.
*/
- value = g_mem_chunk_alloc(pol_hash_value_chunk);
+ value = se_alloc(sizeof(pol_hash_value));
value->list = pol;
pol->next = NULL;
- key = g_mem_chunk_alloc(pol_hash_key_chunk);
+ key = se_alloc(sizeof(pol_hash_key));
memcpy(&key->policy_hnd, policy_hnd, sizeof(key->policy_hnd));
g_hash_table_insert(pol_hash, key, value);
} else {
@@ -610,7 +606,7 @@ void dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, packet_info *pinfo,
/* Create a new value */
- pol = g_mem_chunk_alloc(pol_value_chunk);
+ pol = se_alloc(sizeof(pol_value));
pol->open_frame = is_open ? pinfo->fd->num : 0;
pol->close_frame = is_close ? pinfo->fd->num : 0;
@@ -664,7 +660,7 @@ void dcerpc_smb_store_pol_name(e_ctx_hnd *policy_hnd, packet_info *pinfo,
/* Create a new value */
- pol = g_mem_chunk_alloc(pol_value_chunk);
+ pol = se_alloc(sizeof(pol_value));
pol->open_frame = 0;
pol->close_frame = 0;
@@ -744,29 +740,6 @@ static void free_pol_keyvalue(gpointer key _U_, gpointer value_arg,
static void init_pol_hash(void)
{
- /* Initialise memory chunks */
-
- if (pol_hash_key_chunk)
- g_mem_chunk_destroy(pol_hash_key_chunk);
-
- pol_hash_key_chunk = g_mem_chunk_new(
- "Policy handle hash keys", sizeof(pol_hash_key),
- POL_HASH_INIT_COUNT * sizeof(pol_hash_key), G_ALLOC_ONLY);
-
- if (pol_value_chunk)
- g_mem_chunk_destroy(pol_value_chunk);
-
- pol_value_chunk = g_mem_chunk_new(
- "Policy handle values", sizeof(pol_value),
- POL_HASH_INIT_COUNT * sizeof(pol_value), G_ALLOC_ONLY);
-
- if (pol_hash_value_chunk)
- g_mem_chunk_destroy(pol_hash_value_chunk);
-
- pol_hash_value_chunk = g_mem_chunk_new(
- "Policy handle hash values", sizeof(pol_hash_value),
- POL_HASH_INIT_COUNT * sizeof(pol_hash_value), G_ALLOC_ONLY);
-
/* Initialise hash table */
if (pol_hash) {
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index 9f8ad0d758..cb89d45798 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -42,6 +42,7 @@
#include <epan/prefs.h>
#include <epan/reassemble.h>
#include <epan/tap.h>
+#include <epan/emem.h>
#include <epan/dissectors/packet-frame.h>
#include <epan/dissectors/packet-dcerpc-nt.h>
@@ -800,9 +801,6 @@ typedef struct _dcerpc_bind_value {
guint16 ver;
} dcerpc_bind_value;
-static GMemChunk *dcerpc_bind_key_chunk=NULL;
-static GMemChunk *dcerpc_bind_value_chunk=NULL;
-
static gint
dcerpc_bind_equal (gconstpointer k1, gconstpointer k2)
{
@@ -843,12 +841,6 @@ typedef struct _dcerpc_dg_call_key {
e_uuid_t act_id ;
} dcerpc_dg_call_key;
-static GMemChunk *dcerpc_cn_call_key_chunk=NULL;
-
-static GMemChunk *dcerpc_dg_call_key_chunk=NULL;
-
-static GMemChunk *dcerpc_call_value_chunk=NULL;
-
static gint
dcerpc_cn_call_equal (gconstpointer k1, gconstpointer k2)
@@ -903,8 +895,6 @@ typedef struct _dcerpc_matched_key {
guint32 call_id;
} dcerpc_matched_key;
-static GMemChunk *dcerpc_matched_key_chunk=NULL;
-
static gint
dcerpc_matched_equal (gconstpointer k1, gconstpointer k2)
{
@@ -2676,12 +2666,12 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo,
dcerpc_bind_key *key;
dcerpc_bind_value *value;
- key = g_mem_chunk_alloc (dcerpc_bind_key_chunk);
+ key = se_alloc (sizeof (dcerpc_bind_key));
key->conv = conv;
key->ctx_id = ctx_id;
key->smb_fid = dcerpc_get_transport_salt(pinfo);
- value = g_mem_chunk_alloc (dcerpc_bind_value_chunk);
+ value = se_alloc (sizeof (dcerpc_bind_value));
value->uuid = if_id;
value->ver = if_ver;
@@ -3231,11 +3221,11 @@ dcerpc_add_conv_to_bind_table(decode_dcerpc_bind_values_t *binding)
0);
}
- bind_value = g_mem_chunk_alloc (dcerpc_bind_value_chunk);
+ bind_value = se_alloc (sizeof (dcerpc_bind_value));
bind_value->uuid = binding->uuid;
bind_value->ver = binding->ver;
- key = g_mem_chunk_alloc(dcerpc_bind_key_chunk);
+ key = se_alloc(sizeof (dcerpc_bind_key));
key->conv = conv;
key->ctx_id = binding->ctx_id;
key->smb_fid = binding->smb_fid;
@@ -3351,7 +3341,7 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo,
call_key.call_id=hdr->call_id;
call_key.smb_fid=dcerpc_get_transport_salt(pinfo);
if((call_value=g_hash_table_lookup(dcerpc_cn_calls, &call_key))){
- new_matched_key = g_mem_chunk_alloc(dcerpc_matched_key_chunk);
+ new_matched_key = se_alloc(sizeof (dcerpc_matched_key));
*new_matched_key = matched_key;
g_hash_table_insert (dcerpc_matched, new_matched_key, call_value);
value = call_value;
@@ -3365,7 +3355,7 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo,
the call to both the call table and the
matched table
*/
- call_key=g_mem_chunk_alloc (dcerpc_cn_call_key_chunk);
+ call_key=se_alloc (sizeof (dcerpc_cn_call_key));
call_key->conv=conv;
call_key->call_id=hdr->call_id;
call_key->smb_fid=dcerpc_get_transport_salt(pinfo);
@@ -3376,7 +3366,7 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo,
g_hash_table_remove(dcerpc_cn_calls, call_key);
}
- call_value=g_mem_chunk_alloc (dcerpc_call_value_chunk);
+ call_value=se_alloc (sizeof (dcerpc_call_value));
call_value->uuid = bind_value->uuid;
call_value->ver = bind_value->ver;
call_value->opnum = opnum;
@@ -3388,7 +3378,7 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo,
call_value->private_data = NULL;
g_hash_table_insert (dcerpc_cn_calls, call_key, call_value);
- new_matched_key = g_mem_chunk_alloc(dcerpc_matched_key_chunk);
+ new_matched_key = se_alloc(sizeof (dcerpc_matched_key));
*new_matched_key = matched_key;
g_hash_table_insert (dcerpc_matched, new_matched_key, call_value);
value = call_value;
@@ -3499,7 +3489,7 @@ dissect_dcerpc_cn_resp (tvbuff_t *tvb, gint offset, packet_info *pinfo,
/* extra sanity check, only match them if the reply
came after the request */
if(call_value->req_frame<pinfo->fd->num){
- new_matched_key = g_mem_chunk_alloc(dcerpc_matched_key_chunk);
+ new_matched_key = se_alloc(sizeof (dcerpc_matched_key));
*new_matched_key = matched_key;
g_hash_table_insert (dcerpc_matched, new_matched_key, call_value);
value = call_value;
@@ -3620,7 +3610,7 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo,
call_key.smb_fid=dcerpc_get_transport_salt(pinfo);
if((call_value=g_hash_table_lookup(dcerpc_cn_calls, &call_key))){
- new_matched_key = g_mem_chunk_alloc(dcerpc_matched_key_chunk);
+ new_matched_key = se_alloc(sizeof (dcerpc_matched_key));
*new_matched_key = matched_key;
g_hash_table_insert (dcerpc_matched, new_matched_key, call_value);
value = call_value;
@@ -4477,12 +4467,12 @@ dissect_dcerpc_dg_rqst (tvbuff_t *tvb, int offset, packet_info *pinfo,
dcerpc_call_value *call_value;
dcerpc_dg_call_key *call_key;
- call_key=g_mem_chunk_alloc (dcerpc_dg_call_key_chunk);
+ call_key=se_alloc (sizeof (dcerpc_dg_call_key));
call_key->conv=conv;
call_key->seqnum=hdr->seqnum;
call_key->act_id=hdr->act_id;
- call_value=g_mem_chunk_alloc (dcerpc_call_value_chunk);
+ call_value=se_alloc (sizeof (dcerpc_call_value));
call_value->uuid = hdr->if_id;
call_value->ver = hdr->if_ver;
call_value->opnum = hdr->opnum;
@@ -4494,7 +4484,7 @@ dissect_dcerpc_dg_rqst (tvbuff_t *tvb, int offset, packet_info *pinfo,
call_value->private_data = NULL;
g_hash_table_insert (dcerpc_dg_calls, call_key, call_value);
- new_matched_key = g_mem_chunk_alloc(dcerpc_matched_key_chunk);
+ new_matched_key = se_alloc(sizeof (dcerpc_matched_key));
new_matched_key->frame = pinfo->fd->num;
new_matched_key->call_id = hdr->seqnum;
g_hash_table_insert (dcerpc_matched, new_matched_key, call_value);
@@ -4553,7 +4543,7 @@ dissect_dcerpc_dg_resp (tvbuff_t *tvb, int offset, packet_info *pinfo,
call_key.act_id=hdr->act_id;
if((call_value=g_hash_table_lookup(dcerpc_dg_calls, &call_key))){
- new_matched_key = g_mem_chunk_alloc(dcerpc_matched_key_chunk);
+ new_matched_key = se_alloc(sizeof (dcerpc_matched_key));
new_matched_key->frame = pinfo->fd->num;
new_matched_key->call_id = hdr->seqnum;
g_hash_table_insert (dcerpc_matched, new_matched_key, call_value);
@@ -5047,20 +5037,6 @@ dcerpc_init_protocol (void)
dcerpc_binds = g_hash_table_new (dcerpc_bind_hash, dcerpc_bind_equal);
}
- if (dcerpc_bind_key_chunk){
- g_mem_chunk_destroy (dcerpc_bind_key_chunk);
- }
- dcerpc_bind_key_chunk = g_mem_chunk_new ("dcerpc_bind_key_chunk",
- sizeof (dcerpc_bind_key),
- 200 * sizeof (dcerpc_bind_key),
- G_ALLOC_ONLY);
- if (dcerpc_bind_value_chunk){
- g_mem_chunk_destroy (dcerpc_bind_value_chunk);
- }
- dcerpc_bind_value_chunk = g_mem_chunk_new ("dcerpc_bind_value_chunk",
- sizeof (dcerpc_bind_value),
- 200 * sizeof (dcerpc_bind_value),
- G_ALLOC_ONLY);
/* structures and data for CALL */
if (dcerpc_cn_calls){
g_hash_table_destroy (dcerpc_cn_calls);
@@ -5070,41 +5046,12 @@ dcerpc_init_protocol (void)
g_hash_table_destroy (dcerpc_dg_calls);
}
dcerpc_dg_calls = g_hash_table_new (dcerpc_dg_call_hash, dcerpc_dg_call_equal);
- if (dcerpc_cn_call_key_chunk){
- g_mem_chunk_destroy (dcerpc_cn_call_key_chunk);
- }
- dcerpc_cn_call_key_chunk = g_mem_chunk_new ("dcerpc_cn_call_key_chunk",
- sizeof (dcerpc_cn_call_key),
- 200 * sizeof (dcerpc_cn_call_key),
- G_ALLOC_ONLY);
- if (dcerpc_dg_call_key_chunk){
- g_mem_chunk_destroy (dcerpc_dg_call_key_chunk);
- }
- dcerpc_dg_call_key_chunk = g_mem_chunk_new ("dcerpc_dg_call_key_chunk",
- sizeof (dcerpc_dg_call_key),
- 200 * sizeof (dcerpc_dg_call_key),
- G_ALLOC_ONLY);
-
- if (dcerpc_call_value_chunk){
- g_mem_chunk_destroy (dcerpc_call_value_chunk);
- }
- dcerpc_call_value_chunk = g_mem_chunk_new ("dcerpc_call_value_chunk",
- sizeof (dcerpc_call_value),
- 200 * sizeof (dcerpc_call_value),
- G_ALLOC_ONLY);
/* 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);
- if (dcerpc_matched_key_chunk){
- g_mem_chunk_destroy (dcerpc_matched_key_chunk);
- }
- dcerpc_matched_key_chunk = g_mem_chunk_new ("dcerpc_matched_key_chunk",
- sizeof (dcerpc_matched_key),
- 200 * sizeof (dcerpc_matched_key),
- G_ALLOC_ONLY);
/* call the registered hooks */
g_hook_list_invoke(&dcerpc_hooks_init_protos, FALSE /* not may_recurse */);
diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c
index bd9af15823..b8e83aa002 100644
--- a/epan/dissectors/packet-iax2.c
+++ b/epan/dissectors/packet-iax2.c
@@ -38,6 +38,7 @@
#include <epan/circuit.h>
#include <epan/packet.h>
#include <epan/to_str.h>
+#include <epan/emem.h>
#include "packet-iax2.h"
#include "iax2_codec_type.h"
@@ -391,8 +392,6 @@ typedef struct {
/* tables */
static GHashTable *iax_circuit_hashtab = NULL;
-static GMemChunk *iax_circuit_keys = NULL;
-static GMemChunk *iax_circuit_vals = NULL;
static guint circuitcount = 0;
/* the number of keys and values to reserve space for in each memory chunk.
@@ -482,7 +481,7 @@ static guint iax_circuit_lookup(const address *address,
if( ! circuit_id_p ) {
iax_circuit_key *new_key;
- new_key = g_mem_chunk_alloc(iax_circuit_keys);
+ new_key = se_alloc(sizeof(iax_circuit_key));
new_key->addr.type = address->type;
new_key->addr.len = MIN(address->len,MAX_ADDRESS);
new_key->addr.data = new_key->address_data;
@@ -491,7 +490,7 @@ static guint iax_circuit_lookup(const address *address,
new_key->port = port;
new_key->callno = callno;
- circuit_id_p = g_mem_chunk_alloc(iax_circuit_vals);
+ circuit_id_p = se_alloc(sizeof(iax_circuit_key));
*circuit_id_p = ++circuitcount;
g_hash_table_insert(iax_circuit_hashtab, new_key, circuit_id_p);
@@ -540,32 +539,13 @@ typedef struct iax_call_data {
nstime_t start_time;
} iax_call_data;
-static GMemChunk *iax_call_datas = NULL;
-
static void iax_init_hash( void )
{
if (iax_circuit_hashtab)
g_hash_table_destroy(iax_circuit_hashtab);
- if (iax_circuit_keys)
- g_mem_chunk_destroy(iax_circuit_keys);
- if (iax_circuit_vals)
- g_mem_chunk_destroy(iax_circuit_vals);
- if (iax_call_datas)
- g_mem_chunk_destroy(iax_call_datas);
-
iax_circuit_hashtab = g_hash_table_new(iax_circuit_hash, iax_circuit_equal);
- iax_circuit_keys = g_mem_chunk_create(iax_circuit_key,
- 2*IAX_INIT_PACKET_COUNT,
- G_ALLOC_ONLY);
- iax_circuit_vals = g_mem_chunk_create(iax_circuit_key,
- 2*IAX_INIT_PACKET_COUNT,
- G_ALLOC_ONLY);
-
- iax_call_datas = g_mem_chunk_create(iax_call_data,
- IAX_INIT_PACKET_COUNT,
- G_ALLOC_ONLY);
circuitcount = 0;
}
@@ -829,7 +809,7 @@ static iax_call_data *iax_new_call( packet_info *pinfo,
circuit_id = iax_circuit_lookup(&pinfo->src,pinfo->ptype,
pinfo->srcport,scallno);
- call = g_mem_chunk_alloc(iax_call_datas);
+ call = se_alloc(sizeof(iax_call_data));
call -> dataformat = 0;
call -> src_codec = 0;
call -> dst_codec = 0;
@@ -859,11 +839,9 @@ typedef struct iax_packet_data {
* timestamp and the NEW packet's time (-1 if unknown) */
} iax_packet_data;
-static GMemChunk *iax_packets = NULL;
-
static iax_packet_data *iax_new_packet_data(iax_call_data *call, gboolean reversed)
{
- iax_packet_data *p = g_mem_chunk_alloc(iax_packets);
+ iax_packet_data *p = se_alloc(sizeof(iax_packet_data));
p->first_time=TRUE;
p->call_data=call;
p->codec=0;
@@ -1721,9 +1699,6 @@ iax_init_protocol(void)
{
iax_init_hash();
- if (iax_packets)
- g_mem_chunk_destroy(iax_packets);
- iax_packets = g_mem_chunk_create(iax_packet_data,128,G_ALLOC_ONLY);
}
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index b6f04ad447..8b45509dab 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -282,9 +282,6 @@ struct jxta_stream_conversation_data {
typedef struct jxta_stream_conversation_data jxta_stream_conversation_data;
-static GMemChunk *my_conv_structs = NULL;
-static GMemChunk *my_tap_structs = NULL;
-
/**
* Prototypes
**/
@@ -505,7 +502,7 @@ static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
tpt_conv_data = (jxta_stream_conversation_data*) conversation_get_proto_data(tpt_conversation, proto_jxta);
if( NULL == tpt_conv_data ) {
- tpt_conv_data = (jxta_stream_conversation_data*) g_mem_chunk_alloc(my_conv_structs);
+ tpt_conv_data = se_alloc(sizeof( jxta_stream_conversation_data ));
tpt_conv_data->tpt_ptype = PT_NONE;
tpt_conv_data->initiator_welcome_frame = 0;
tpt_conv_data->initiator_address.type = AT_NONE;
@@ -1163,7 +1160,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
}
if ((offset > 0) && (AT_URI == pinfo->src.type) && (AT_URI == pinfo->dst.type)) {
- jxta_tap_header * tap_header = (jxta_tap_header *) g_mem_chunk_alloc(my_tap_structs);
+ jxta_tap_header * tap_header = se_alloc(sizeof( jxta_tap_header ));
tap_header->src_address = pinfo->src;
tap_header->dest_address = pinfo->dst;
@@ -1455,30 +1452,6 @@ static int dissect_jxta_message_element(tvbuff_t * tvb, packet_info * pinfo, pro
return offset;
}
-static void jxta_dissector_init( void)
-{
- /* destroy memory chunks if needed */
-
- if ( NULL != my_tap_structs )
- g_mem_chunk_destroy( my_tap_structs );
-
-
- if ( NULL != my_conv_structs )
- g_mem_chunk_destroy( my_conv_structs );
-
- /* now create memory chunks */
-
- my_tap_structs = g_mem_chunk_new( "my_tap_structs",
- sizeof( jxta_tap_header ),
- 10 * sizeof( jxta_tap_header ),
- G_ALLOC_ONLY);
-
- my_conv_structs = g_mem_chunk_new( "my_conv_structs",
- sizeof( jxta_stream_conversation_data ),
- 10 * sizeof( jxta_stream_conversation_data ),
- G_ALLOC_ONLY);
-}
-
/**
* Register jxta protocol and jxta message protocol, header fields, subtree types, preferences.
**/
@@ -1488,8 +1461,6 @@ void proto_register_jxta(void)
/* register re-init routine */
- register_init_routine( &jxta_dissector_init);
-
proto_jxta = proto_register_protocol("JXTA P2P", "JXTA", "jxta");
jxta_tap = register_tap("jxta");
diff --git a/epan/dissectors/packet-ncp.c b/epan/dissectors/packet-ncp.c
index b8b716e1c9..9b39dfd32d 100644
--- a/epan/dissectors/packet-ncp.c
+++ b/epan/dissectors/packet-ncp.c
@@ -45,6 +45,7 @@
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/prefs.h>
#include "packet-ipx.h"
#include "packet-tcp.h"
@@ -203,8 +204,6 @@ typedef struct {
} mncp_rhash_value;
static GHashTable *mncp_rhash = NULL;
-static GMemChunk *mncp_rhash_keys = NULL;
-static GMemChunk *mncp_rhash_values = NULL;
/* Hash Functions */
static gint
@@ -233,20 +232,8 @@ mncp_init_protocol(void)
{
if (mncp_rhash)
g_hash_table_destroy(mncp_rhash);
- if (mncp_rhash_keys)
- g_mem_chunk_destroy(mncp_rhash_keys);
- if (mncp_rhash_values)
- g_mem_chunk_destroy(mncp_rhash_values);
mncp_rhash = g_hash_table_new(mncp_hash, mncp_equal);
- mncp_rhash_keys = g_mem_chunk_new("mncp_rhash_keys",
- sizeof(mncp_rhash_key),
- 200 * sizeof(mncp_rhash_key),
- G_ALLOC_ONLY);
- mncp_rhash_values = g_mem_chunk_new("mncp_rhash_values",
- sizeof(mncp_rhash_value),
- 200 * sizeof(mncp_rhash_value),
- G_ALLOC_ONLY);
}
/* After the sequential run, we don't need the ncp_request hash and keys
@@ -265,10 +252,10 @@ mncp_hash_insert(conversation_t *conversation)
/* Now remember the request, so we can find it if we later
a reply to it. */
- key = g_mem_chunk_alloc(mncp_rhash_keys);
+ key = se_alloc(sizeof(mncp_rhash_key));
key->conversation = conversation;
- value = g_mem_chunk_alloc(mncp_rhash_values);
+ value = se_alloc(sizeof(mncp_rhash_value));
value->packet_signature = FALSE;
g_hash_table_insert(mncp_rhash, key, value);
diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c
index 7181aa8aea..448aab6cfd 100644
--- a/epan/dissectors/packet-ntlmssp.c
+++ b/epan/dissectors/packet-ntlmssp.c
@@ -38,6 +38,7 @@
#include "packet-smb-common.h"
#include "packet-frame.h"
#include <epan/prefs.h>
+#include <epan/emem.h>
#include <epan/crypt-rc4.h>
#include <epan/crypt-md4.h>
#include <epan/crypt-des.h>
@@ -232,12 +233,6 @@ typedef struct _ntlmssp_info {
ntlmssp_blob lm_response;
} ntlmssp_info;
-/*
- * GMemChunk from which ntlmssp_info structures are allocated.
- */
-static GMemChunk *ntlmssp_info_chunk;
-static int ntlmssp_info_count = 10;
-
/* If this struct exists in the payload_decrypt, then we have already
decrypted it once */
typedef struct _ntlmssp_packet_info {
@@ -248,11 +243,6 @@ typedef struct _ntlmssp_packet_info {
gboolean verifier_decrypted;
} ntlmssp_packet_info;
-/*
- * GMemChunk from which ntlmssp_packet_info structures are allocated.
- */
-static GMemChunk *ntlmssp_packet_info_chunk;
-static int ntlmssp_packet_info_count = 10;
/*
* GSlist of decrypted payloads.
@@ -937,7 +927,7 @@ dissect_ntlmssp_challenge (tvbuff_t *tvb, packet_info *pinfo, int offset,
}
if (!conversation_get_proto_data(conversation, proto_ntlmssp)) {
- conv_ntlmssp_info = g_mem_chunk_alloc(ntlmssp_info_chunk);
+ conv_ntlmssp_info = se_alloc(sizeof(ntlmssp_info));
/* Insert the flags into the conversation */
conv_ntlmssp_info->flags = negotiate_flags;
/* Insert the RC4 state information into the conversation */
@@ -1439,7 +1429,7 @@ dissect_ntlmssp_encrypted_payload(tvbuff_t *data_tvb,
packet_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
if (packet_ntlmssp_info == NULL) {
/* We don't have any packet state, so create one */
- packet_ntlmssp_info = g_mem_chunk_alloc(ntlmssp_packet_info_chunk);
+ packet_ntlmssp_info = se_alloc(sizeof(ntlmssp_packet_info));
memset(packet_ntlmssp_info, 0, sizeof(ntlmssp_packet_info));
p_add_proto_data(pinfo->fd, proto_ntlmssp, packet_ntlmssp_info);
}
@@ -1520,11 +1510,6 @@ free_payload(gpointer decrypted_payload, gpointer user_data _U_)
static void
ntlmssp_init_protocol(void)
{
- if (ntlmssp_info_chunk != NULL)
- g_mem_chunk_destroy(ntlmssp_info_chunk);
- if (ntlmssp_packet_info_chunk != NULL)
- g_mem_chunk_destroy(ntlmssp_packet_info_chunk);
-
/*
* Free the decrypted payloads, and then free the list of decrypted
* payloads.
@@ -1535,14 +1520,6 @@ ntlmssp_init_protocol(void)
decrypted_payloads = NULL;
}
- ntlmssp_info_chunk = g_mem_chunk_new("ntlmssp_info_chunk",
- sizeof(ntlmssp_info),
- ntlmssp_info_count * sizeof(ntlmssp_info),
- G_ALLOC_ONLY);
- ntlmssp_packet_info_chunk = g_mem_chunk_new("ntlmssp_packet_info_chunk",
- sizeof(ntlmssp_packet_info),
- ntlmssp_packet_info_count * sizeof(ntlmssp_packet_info),
- G_ALLOC_ONLY);
}
void
diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c
index 65a58e6a57..ca5c000033 100644
--- a/epan/dissectors/packet-rpc.c
+++ b/epan/dissectors/packet-rpc.c
@@ -455,10 +455,6 @@ typedef struct _rpc_call_info_key {
conversation_t *conversation;
} rpc_call_info_key;
-static GMemChunk *rpc_call_info_key_chunk;
-
-static GMemChunk *rpc_call_info_value_chunk;
-
static GHashTable *rpc_calls;
static GHashTable *rpc_indir_calls;
@@ -1440,9 +1436,9 @@ dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
Prepare the value data.
Not all of it is needed for handling indirect
calls, so we set a bunch of items to 0. */
- new_rpc_call_key = g_mem_chunk_alloc(rpc_call_info_key_chunk);
+ new_rpc_call_key = se_alloc(sizeof(rpc_call_info_key));
*new_rpc_call_key = rpc_call_key;
- rpc_call = g_mem_chunk_alloc(rpc_call_info_value_chunk);
+ rpc_call = se_alloc(sizeof(rpc_call_info_value));
rpc_call->req_num = 0;
rpc_call->rep_num = 0;
rpc_call->prog = prog;
@@ -1860,9 +1856,9 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/* in parse-partials, so define a dummy conversation for this reply */
- new_rpc_call_key = g_mem_chunk_alloc(rpc_call_info_key_chunk);
+ new_rpc_call_key = se_alloc(sizeof(rpc_call_info_key));
*new_rpc_call_key = rpc_call_key;
- rpc_call = g_mem_chunk_alloc(rpc_call_info_value_chunk);
+ rpc_call = se_alloc(sizeof(rpc_call_info_value));
rpc_call->req_num = 0;
rpc_call->rep_num = pinfo->fd->num;
rpc_call->prog = 0;
@@ -2156,9 +2152,9 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
frame numbers are 1-origin, so we use 0
to mean "we don't yet know in which frame
the reply for this call appears". */
- new_rpc_call_key = g_mem_chunk_alloc(rpc_call_info_key_chunk);
+ new_rpc_call_key = se_alloc(sizeof(rpc_call_info_key));
*new_rpc_call_key = rpc_call_key;
- rpc_call = g_mem_chunk_alloc(rpc_call_info_value_chunk);
+ rpc_call = se_alloc(sizeof(rpc_call_info_value));
rpc_call->req_num = pinfo->fd->num;
rpc_call->rep_num = 0;
rpc_call->prog = prog;
@@ -2689,8 +2685,6 @@ dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static GHashTable *rpc_fragment_table = NULL;
static GHashTable *rpc_reassembly_table = NULL;
-static GMemChunk *rpc_fragment_key_chunk = NULL;
-static int rpc_fragment_init_count = 200;
typedef struct _rpc_fragment_key {
guint32 conv_id;
@@ -3033,7 +3027,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
* We must remember this fragment.
*/
- rfk = g_mem_chunk_alloc(rpc_fragment_key_chunk);
+ rfk = se_alloc(sizeof(rpc_fragment_key));
rfk->conv_id = conversation->index;
rfk->seq = seq;
rfk->offset = 0;
@@ -3054,7 +3048,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
* set on it.
*/
if (ipfd_head == NULL) {
- new_rfk = g_mem_chunk_alloc(rpc_fragment_key_chunk);
+ new_rfk = se_alloc(sizeof(rpc_fragment_key));
new_rfk->conv_id = rfk->conv_id;
new_rfk->seq = seq + len;
new_rfk->offset = rfk->offset + len - 4;
@@ -3119,7 +3113,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
* RPC fragments aren't guaranteed to be provided
* in order, either.
*/
- new_rfk = g_mem_chunk_alloc(rpc_fragment_key_chunk);
+ new_rfk = se_alloc(sizeof(rpc_fragment_key));
new_rfk->conv_id = rfk->conv_id;
new_rfk->seq = seq + len;
new_rfk->offset = rfk->offset + len - 4;
@@ -3519,18 +3513,6 @@ rpc_init_protocol(void)
g_hash_table_destroy(rpc_indir_calls);
rpc_indir_calls = NULL;
}
- if (rpc_call_info_key_chunk != NULL) {
- g_mem_chunk_destroy(rpc_call_info_key_chunk);
- rpc_call_info_key_chunk = NULL;
- }
- if (rpc_call_info_value_chunk != NULL) {
- g_mem_chunk_destroy(rpc_call_info_value_chunk);
- rpc_call_info_value_chunk = NULL;
- }
- if (rpc_fragment_key_chunk != NULL) {
- g_mem_chunk_destroy(rpc_fragment_key_chunk);
- rpc_fragment_key_chunk = NULL;
- }
if (rpc_reassembly_table != NULL) {
g_hash_table_destroy(rpc_reassembly_table);
rpc_reassembly_table = NULL;
@@ -3538,18 +3520,6 @@ rpc_init_protocol(void)
rpc_calls = g_hash_table_new(rpc_call_hash, rpc_call_equal);
rpc_indir_calls = g_hash_table_new(rpc_call_hash, rpc_call_equal);
- rpc_call_info_key_chunk = g_mem_chunk_new("call_info_key_chunk",
- sizeof(rpc_call_info_key),
- 200 * sizeof(rpc_call_info_key),
- G_ALLOC_ONLY);
- rpc_call_info_value_chunk = g_mem_chunk_new("call_info_value_chunk",
- sizeof(rpc_call_info_value),
- 200 * sizeof(rpc_call_info_value),
- G_ALLOC_ONLY);
- rpc_fragment_key_chunk = g_mem_chunk_new("rpc_fragment_key_chunk",
- sizeof(rpc_fragment_key),
- rpc_fragment_init_count*sizeof(rpc_fragment_key),
- G_ALLOC_ONLY);
rpc_reassembly_table = g_hash_table_new(rpc_fragment_hash,
rpc_fragment_equal);
diff --git a/epan/dissectors/packet-smb-sidsnooping.c b/epan/dissectors/packet-smb-sidsnooping.c
index 79997eb686..193d6ab5c2 100644
--- a/epan/dissectors/packet-smb-sidsnooping.c
+++ b/epan/dissectors/packet-smb-sidsnooping.c
@@ -33,6 +33,7 @@
#include "epan/epan_dissect.h"
#include "epan/proto.h"
#include <epan/tap.h>
+#include <epan/emem.h>
#include "packet-dcerpc.h"
#include "packet-dcerpc-nt.h"
#include "register.h"
@@ -52,13 +53,8 @@ static int hf_samr_level = -1;
GHashTable *sid_name_table = NULL;
-static GMemChunk *sid_name_chunk = NULL;
-static int sid_name_init_count = 200;
-
-static GMemChunk *ctx_handle_chunk = NULL;
-static int ctx_handle_init_count = 200;
static GHashTable *ctx_handle_table = NULL;
@@ -92,7 +88,7 @@ add_sid_name_mapping(char *sid, char *name)
return;
}
- sn=g_mem_chunk_alloc(sid_name_chunk);
+ sn=se_alloc(sizeof(sid_name));
sn->sid=g_strdup(sid);
sn->name=g_strdup(name);
g_hash_table_insert(sid_name_table, sn, sn);
@@ -152,7 +148,7 @@ samr_query_dispinfo(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt, co
g_hash_table_remove(ctx_handle_table, GINT_TO_POINTER(pinfo->fd->num));
}
if(!old_ctx){
- old_ctx=g_mem_chunk_alloc(ctx_handle_chunk);
+ old_ctx=se_alloc(20);
memcpy(old_ctx, fi->value.value.bytes->data, 20);
}
g_hash_table_insert(ctx_handle_table, GINT_TO_POINTER(pinfo->fd->num), old_ctx);
@@ -347,18 +343,10 @@ sid_snooping_init(void)
g_hash_table_foreach_remove(sid_name_table, free_all_sid_names, NULL);
sid_name_table=NULL;
}
- if(sid_name_chunk){
- g_mem_chunk_destroy(sid_name_chunk);
- sid_name_chunk=NULL;
- }
if(ctx_handle_table){
g_hash_table_foreach_remove(ctx_handle_table, free_all_ctx_handle, NULL);
ctx_handle_table=NULL;
}
- if(ctx_handle_chunk){
- g_mem_chunk_destroy(ctx_handle_chunk);
- ctx_handle_chunk=NULL;
- }
if(!sid_name_snooping){
@@ -367,17 +355,9 @@ sid_snooping_init(void)
sid_name_table=g_hash_table_new(sid_name_hash, sid_name_equal);
- sid_name_chunk = g_mem_chunk_new("sid_name_chunk",
- sizeof(sid_name),
- sid_name_init_count * sizeof(sid_name),
- G_ALLOC_ONLY);
ctx_handle_table=g_hash_table_new(ctx_handle_hash, ctx_handle_equal);
- ctx_handle_chunk = g_mem_chunk_new("ctx_handle_chunk",
- 20, /* our dcerpc context handles are 20 bytes */
- ctx_handle_init_count * 20,
- G_ALLOC_ONLY);
hf_lsa=proto_get_id_by_filter_name("lsa");
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index 9140558b50..1e5fffb98e 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -43,6 +43,7 @@
#include <epan/prefs.h>
#include <epan/reassemble.h>
#include <epan/tap.h>
+#include <epan/emem.h>
#include "packet-ipx.h"
#include "packet-idp.h"
@@ -895,10 +896,6 @@ typedef struct {
guint32 pid_mid;
} smb_saved_info_key_t;
-static GMemChunk *smb_saved_info_key_chunk = NULL;
-static GMemChunk *smb_saved_info_chunk = NULL;
-static int smb_saved_info_init_count = 200;
-
/* unmatched smb_saved_info structures.
For unmatched smb_saved_info structures we store the smb_saved_info
structure using the MID and the PID as the key.
@@ -948,23 +945,7 @@ smb_saved_info_hash_matched(gconstpointer k)
return key->frame + key->pid_mid;
}
-static GMemChunk *smb_nt_transact_info_chunk = NULL;
-static int smb_nt_transact_info_init_count = 200;
-
-static GMemChunk *smb_transact2_info_chunk = NULL;
-static int smb_transact2_info_init_count = 200;
-
-/*
- * The information we need to save about a Transaction request in order
- * to dissect the reply; this includes information for use by the
- * Remote API dissector.
- */
-static GMemChunk *smb_transact_info_chunk = NULL;
-static int smb_transact_info_init_count = 200;
-
-static GMemChunk *conv_tables_chunk = NULL;
static GSList *conv_tables = NULL;
-static int conv_tables_count = 10;
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -7684,7 +7665,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
* Allocate a new smb_nt_transact_info_t
* structure.
*/
- nti = g_mem_chunk_alloc(smb_nt_transact_info_chunk);
+ nti = se_alloc(sizeof(smb_nt_transact_info_t));
nti->subcmd = subcmd;
sip->extra_info = nti;
sip->extra_info_type = SMB_EI_NTI;
@@ -11496,7 +11477,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* smb_transact2_info_t
* structure.
*/
- t2i = g_mem_chunk_alloc(smb_transact2_info_chunk);
+ t2i = se_alloc(sizeof(smb_transact2_info_t));
t2i->subcmd = subcmd;
t2i->info_level = -1;
t2i->resume_keys = FALSE;
@@ -11647,7 +11628,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* Allocate a new smb_transact_info_t
* structure.
*/
- tri = g_mem_chunk_alloc(smb_transact_info_chunk);
+ tri = se_alloc(sizeof(smb_transact_info_t));
tri->subcmd = -1;
tri->trans_subcmd = -1;
tri->function = -1;
@@ -14435,17 +14416,6 @@ free_hash_tables(gpointer ctarg, gpointer user_data _U_)
static void
smb_init_protocol(void)
{
- if (smb_saved_info_key_chunk)
- g_mem_chunk_destroy(smb_saved_info_key_chunk);
- if (smb_saved_info_chunk)
- g_mem_chunk_destroy(smb_saved_info_chunk);
- if (smb_nt_transact_info_chunk)
- g_mem_chunk_destroy(smb_nt_transact_info_chunk);
- if (smb_transact2_info_chunk)
- g_mem_chunk_destroy(smb_transact2_info_chunk);
- if (smb_transact_info_chunk)
- g_mem_chunk_destroy(smb_transact_info_chunk);
-
/*
* Free the hash tables attached to the conversation table
* structures, and then free the list of conversation table
@@ -14458,38 +14428,6 @@ smb_init_protocol(void)
g_slist_free(conv_tables);
conv_tables = NULL;
}
-
- /*
- * Now destroy the chunk from which the conversation table
- * structures were allocated.
- */
- if (conv_tables_chunk)
- g_mem_chunk_destroy(conv_tables_chunk);
-
- smb_saved_info_chunk = g_mem_chunk_new("smb_saved_info_chunk",
- sizeof(smb_saved_info_t),
- smb_saved_info_init_count * sizeof(smb_saved_info_t),
- G_ALLOC_ONLY);
- smb_saved_info_key_chunk = g_mem_chunk_new("smb_saved_info_key_chunk",
- sizeof(smb_saved_info_key_t),
- smb_saved_info_init_count * sizeof(smb_saved_info_key_t),
- G_ALLOC_ONLY);
- smb_nt_transact_info_chunk = g_mem_chunk_new("smb_nt_transact_info_chunk",
- sizeof(smb_nt_transact_info_t),
- smb_nt_transact_info_init_count * sizeof(smb_nt_transact_info_t),
- G_ALLOC_ONLY);
- smb_transact2_info_chunk = g_mem_chunk_new("smb_transact2_info_chunk",
- sizeof(smb_transact2_info_t),
- smb_transact2_info_init_count * sizeof(smb_transact2_info_t),
- G_ALLOC_ONLY);
- smb_transact_info_chunk = g_mem_chunk_new("smb_transact_info_chunk",
- sizeof(smb_transact_info_t),
- smb_transact_info_init_count * sizeof(smb_transact_info_t),
- G_ALLOC_ONLY);
- conv_tables_chunk = g_mem_chunk_new("conv_tables_chunk",
- sizeof(conv_tables_t),
- conv_tables_count * sizeof(conv_tables_t),
- G_ALLOC_ONLY);
}
static const value_string errcls_types[] = {
@@ -14829,7 +14767,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
si->ct=conversation_get_proto_data(conversation, proto_smb);
if(!si->ct){
/* No, not yet. create it and attach it to the conversation */
- si->ct = g_mem_chunk_alloc(conv_tables_chunk);
+ si->ct = se_alloc(sizeof(conv_tables_t));
conv_tables = g_slist_prepend(conv_tables, si->ct);
si->ct->matched= g_hash_table_new(smb_saved_info_hash_matched,
smb_saved_info_equal_matched);
@@ -14889,7 +14827,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
*/
sip=g_hash_table_lookup(si->ct->unmatched, GUINT_TO_POINTER(pid_mid));
if(sip!=NULL){
- new_key = g_mem_chunk_alloc(smb_saved_info_key_chunk);
+ new_key = se_alloc(sizeof(smb_saved_info_key_t));
new_key->frame = pinfo->fd->num;
new_key->pid_mid = pid_mid;
g_hash_table_insert(si->ct->matched, new_key,
@@ -15012,7 +14950,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
or it's a continuation of
a response we've seen. */
sip->frame_res = pinfo->fd->num;
- new_key = g_mem_chunk_alloc(smb_saved_info_key_chunk);
+ new_key = se_alloc(sizeof(smb_saved_info_key_t));
new_key->frame = sip->frame_res;
new_key->pid_mid = pid_mid;
g_hash_table_insert(si->ct->matched, new_key, sip);
@@ -15041,7 +14979,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
}
}
if(si->request){
- sip = g_mem_chunk_alloc(smb_saved_info_chunk);
+ sip = se_alloc(sizeof(smb_saved_info_t));
sip->frame_req = pinfo->fd->num;
sip->frame_res = 0;
sip->req_time.secs=pinfo->fd->abs_secs;
@@ -15055,7 +14993,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
sip->extra_info = NULL;
sip->extra_info_type = SMB_EI_NONE;
g_hash_table_insert(si->ct->unmatched, GUINT_TO_POINTER(pid_mid), sip);
- new_key = g_mem_chunk_alloc(smb_saved_info_key_chunk);
+ new_key = se_alloc(sizeof(smb_saved_info_key_t));
new_key->frame = sip->frame_req;
new_key->pid_mid = pid_mid;
g_hash_table_insert(si->ct->matched, new_key, sip);
diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c
index d6cc21821b..0b05d133ce 100644
--- a/epan/dissectors/packet-ssh.c
+++ b/epan/dissectors/packet-ssh.c
@@ -41,6 +41,7 @@
#include "packet-tcp.h"
#include <epan/reassemble.h>
#include <epan/prefs.h>
+#include <epan/emem.h>
/* get from openssh ssh2.h */
#define SSH2_MSG_DISCONNECT 1
@@ -93,8 +94,6 @@ struct ssh_flow_data {
guint rsp_counter;
guint version;
};
-static GMemChunk *ssh_this_data=NULL;
-static GMemChunk *ssh_global_data = NULL;
static int proto_ssh = -1;
static int hf_ssh_packet_length= -1;
@@ -186,22 +185,6 @@ static int ssh_dissect_encrypted_packet(tvbuff_t *tvb, packet_info *pinfo,
proto_item * ssh_proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, gboolean little_endian);
-static void
-ssh_init_protocol(void)
-{
- if (ssh_global_data)
- g_mem_chunk_destroy(ssh_global_data);
- if (ssh_this_data)
- g_mem_chunk_destroy(ssh_this_data);
-
- ssh_global_data = g_mem_chunk_new("ssh_global_datas",
- sizeof(struct ssh_flow_data),
- 100* sizeof(struct ssh_flow_data), G_ALLOC_AND_FREE);
- ssh_this_data = g_mem_chunk_new("ssh_pku_data",
- sizeof(struct ssh_pdu_data),
- 100* sizeof(struct ssh_pdu_data), G_ALLOC_AND_FREE);
-
-}
static void
dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -238,7 +221,7 @@ dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
global_data = conversation_get_proto_data(conversation,proto_ssh);
if(!global_data ) {
- global_data = g_mem_chunk_alloc(ssh_global_data);
+ global_data = se_alloc(sizeof(struct ssh_flow_data));
global_data->req_counter=0;
global_data->rsp_counter=0;
global_data->version=SSH_VERSION_UNKNOWN;
@@ -251,7 +234,7 @@ dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (pinfo->destport == pinfo->match_port) {
is_response=FALSE;
if(!this_data) {
- this_data = g_mem_chunk_alloc(ssh_this_data);
+ this_data = se_alloc(sizeof(struct ssh_pdu_data));
this_data->counter = global_data->req_counter++;
p_add_proto_data(pinfo->fd, proto_ssh, this_data);
is_newdata = TRUE;
@@ -259,7 +242,7 @@ dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}else {
is_response=TRUE;
if(!this_data) {
- this_data = g_mem_chunk_alloc(ssh_global_data);
+ this_data = se_alloc(sizeof(struct ssh_flow_data));
this_data->counter = global_data->rsp_counter++;
p_add_proto_data(pinfo->fd, proto_ssh, this_data);
is_newdata = TRUE;
@@ -919,7 +902,6 @@ proto_register_ssh(void)
"SSH", "ssh");
proto_register_field_array(proto_ssh, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- register_init_routine(&ssh_init_protocol);
ssh_module = prefs_register_protocol(proto_ssh, NULL);
prefs_register_bool_preference(ssh_module, "desegment_buffers",
diff --git a/epan/dissectors/packet-wcp.c b/epan/dissectors/packet-wcp.c
index a3fd2fe68f..7960b5d2ba 100644
--- a/epan/dissectors/packet-wcp.c
+++ b/epan/dissectors/packet-wcp.c
@@ -106,6 +106,7 @@
#include <epan/packet.h>
#include "packet-frame.h"
#include <epan/circuit.h>
+#include <epan/emem.h>
#include "etypes.h"
#include "nlpid.h"
@@ -134,15 +135,6 @@ typedef struct {
}wcp_pdata_t;
-#define wcp_win_init_count 4
-#define wcp_packet_init_count 10
-
-#define wcp_circuit_length (sizeof(wcp_circuit_data_t))
-#define wcp_packet_length (sizeof(wcp_pdata_t))
-
-static GMemChunk *wcp_circuit = NULL;
-static GMemChunk *wcp_pdata = NULL;
-
static int proto_wcp = -1;
static int hf_wcp_cmd = -1;
static int hf_wcp_ext_cmd = -1;
@@ -466,7 +458,7 @@ wcp_window_t *get_wcp_window_ptr( packet_info *pinfo){
}
wcp_circuit_data = circuit_get_proto_data(circuit, proto_wcp);
if ( !wcp_circuit_data){
- wcp_circuit_data = g_mem_chunk_alloc( wcp_circuit);
+ wcp_circuit_data = se_alloc(sizeof(wcp_circuit_data_t));
wcp_circuit_data->recv.buf_cur = wcp_circuit_data->recv.buffer;
wcp_circuit_data->send.buf_cur = wcp_circuit_data->send.buffer;
circuit_add_proto_data(circuit, proto_wcp, wcp_circuit_data);
@@ -583,7 +575,7 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin
} else {
/* save the new data as per packet data */
- pdata_ptr = g_mem_chunk_alloc( wcp_pdata);
+ pdata_ptr = se_alloc(sizeof(wcp_pdata_t));
memcpy( &pdata_ptr->buffer, buf_ptr->buf_cur, len);
pdata_ptr->len = len;
@@ -618,28 +610,6 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin
}
-static void wcp_reinit( void){
-
-/* Do the cleanup work when a new pass through the packet list is */
-/* performed. re-initialize the memory chunks. */
-
- if (wcp_circuit)
- g_mem_chunk_destroy(wcp_circuit);
-
- wcp_circuit = g_mem_chunk_new("wcp_circuit", wcp_circuit_length,
- wcp_win_init_count * wcp_circuit_length,
- G_ALLOC_AND_FREE);
-
- if (wcp_pdata)
- g_mem_chunk_destroy(wcp_pdata);
-
- wcp_pdata = g_mem_chunk_new("wcp_pdata", wcp_packet_length,
- wcp_packet_init_count * wcp_packet_length,
- G_ALLOC_AND_FREE);
-
-}
-
-
void
proto_register_wcp(void)
{
@@ -731,7 +701,6 @@ proto_register_wcp(void)
proto_wcp = proto_register_protocol ("Wellfleet Compression", "WCP", "wcp");
proto_register_field_array (proto_wcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- register_init_routine(&wcp_reinit);
}