aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asn1/h248/packet-h248-template.c16
-rw-r--r--epan/dissectors/packet-h248.c16
-rw-r--r--epan/dissectors/packet-hdcp.c25
-rw-r--r--epan/dissectors/packet-iso7816.c24
-rw-r--r--epan/dissectors/packet-smb.c110
-rw-r--r--epan/dissectors/packet-smb.h8
-rw-r--r--epan/dissectors/packet-stun.c19
7 files changed, 101 insertions, 117 deletions
diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c
index 89bfc51dbf..4d780a2e95 100644
--- a/asn1/h248/packet-h248-template.c
+++ b/asn1/h248/packet-h248-template.c
@@ -96,10 +96,10 @@ static expert_field ei_h248_context_id64 = EI_INIT;
static dissector_table_t subdissector_table;
-static emem_tree_t* msgs = NULL;
-static emem_tree_t* trxs = NULL;
-static emem_tree_t* ctxs_by_trx = NULL;
-static emem_tree_t* ctxs = NULL;
+static wmem_tree_t* msgs = NULL;
+static wmem_tree_t* trxs = NULL;
+static wmem_tree_t* ctxs_by_trx = NULL;
+static wmem_tree_t* ctxs = NULL;
static gboolean keep_persistent_data = FALSE;
static guint global_udp_port = 2945;
@@ -1642,10 +1642,10 @@ void proto_register_h248(void) {
"Desegment H.248 messages that span more TCP segments",
&h248_desegment);
- msgs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_msgs");
- trxs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_trxs");
- ctxs_by_trx = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs_by_trx");
- ctxs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs");
+ msgs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+ trxs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+ ctxs_by_trx = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+ ctxs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
h248_tap = register_tap("h248");
diff --git a/epan/dissectors/packet-h248.c b/epan/dissectors/packet-h248.c
index c372fcd8f7..a0f42e631d 100644
--- a/epan/dissectors/packet-h248.c
+++ b/epan/dissectors/packet-h248.c
@@ -571,10 +571,10 @@ static expert_field ei_h248_context_id64 = EI_INIT;
static dissector_table_t subdissector_table;
-static emem_tree_t* msgs = NULL;
-static emem_tree_t* trxs = NULL;
-static emem_tree_t* ctxs_by_trx = NULL;
-static emem_tree_t* ctxs = NULL;
+static wmem_tree_t* msgs = NULL;
+static wmem_tree_t* trxs = NULL;
+static wmem_tree_t* ctxs_by_trx = NULL;
+static wmem_tree_t* ctxs = NULL;
static gboolean keep_persistent_data = FALSE;
static guint global_udp_port = 2945;
@@ -7008,10 +7008,10 @@ void proto_register_h248(void) {
"Desegment H.248 messages that span more TCP segments",
&h248_desegment);
- msgs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_msgs");
- trxs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_trxs");
- ctxs_by_trx = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs_by_trx");
- ctxs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs");
+ msgs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+ trxs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+ ctxs_by_trx = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+ ctxs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
h248_tap = register_tap("h248");
diff --git a/epan/dissectors/packet-hdcp.c b/epan/dissectors/packet-hdcp.c
index 98f142496e..9fcfc196a9 100644
--- a/epan/dissectors/packet-hdcp.c
+++ b/epan/dissectors/packet-hdcp.c
@@ -37,12 +37,13 @@
#include <epan/packet.h>
#include <epan/ptvcursor.h>
#include <epan/expert.h>
+#include <epan/wmem/wmem.h>
#include "packet-hdcp.h"
static int proto_hdcp = -1;
-static emem_tree_t *transactions = NULL;
+static wmem_tree_t *transactions = NULL;
static gint ett_hdcp = -1;
@@ -115,17 +116,6 @@ sub_check_hdcp(packet_info *pinfo _U_)
return TRUE;
}
-
-static void
-hdcp_init(void)
-{
- /* se_...() allocations are automatically cleared when a new capture starts,
- so we should be safe to create the tree without any previous checks */
- transactions = se_tree_create_non_persistent(
- EMEM_TREE_TYPE_RED_BLACK, "hdcp_transactions");
-}
-
-
static int
dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@@ -170,7 +160,7 @@ dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
if (PINFO_FD_VISITED(pinfo)) {
/* we've already dissected the receiver's response */
- hdcp_trans = (hdcp_transaction_t *)se_tree_lookup32(
+ hdcp_trans = (hdcp_transaction_t *)wmem_tree_lookup32(
transactions, PINFO_FD_NUM(pinfo));
if (hdcp_trans && hdcp_trans->rqst_frame==PINFO_FD_NUM(pinfo) &&
hdcp_trans->resp_frame!=0) {
@@ -188,12 +178,11 @@ dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
else {
/* we've not yet dissected the response */
if (transactions) {
- hdcp_trans = (hdcp_transaction_t *)se_alloc(
- sizeof(hdcp_transaction_t));
+ hdcp_trans = wmem_new(wmem_file_scope(), hdcp_transaction_t);
hdcp_trans->rqst_frame = PINFO_FD_NUM(pinfo);
hdcp_trans->resp_frame = 0;
hdcp_trans->rqst_type = reg;
- se_tree_insert32(transactions,
+ wmem_tree_insert32(transactions,
hdcp_trans->rqst_frame, (void *)hdcp_trans);
}
}
@@ -225,7 +214,7 @@ dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(ADDR8_TRX)+1, ADDR8_TRX);
if (transactions) {
- hdcp_trans = (hdcp_transaction_t *)se_tree_lookup32_le(
+ hdcp_trans = (hdcp_transaction_t *)wmem_tree_lookup32_le(
transactions, PINFO_FD_NUM(pinfo));
if (hdcp_trans) {
if (hdcp_trans->resp_frame==0) {
@@ -381,7 +370,7 @@ proto_register_hdcp(void)
new_register_dissector("hdcp", dissect_hdcp, proto_hdcp);
- register_init_routine(hdcp_init);
+ transactions = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
}
/*
diff --git a/epan/dissectors/packet-iso7816.c b/epan/dissectors/packet-iso7816.c
index cc1013b88b..a20e6f6819 100644
--- a/epan/dissectors/packet-iso7816.c
+++ b/epan/dissectors/packet-iso7816.c
@@ -38,13 +38,14 @@
#include <epan/packet.h>
#include <epan/expert.h>
+#include <epan/wmem/wmem.h>
static int proto_iso7816 = -1;
static int proto_iso7816_atr = -1;
static dissector_handle_t iso7816_atr_handle;
-static emem_tree_t *transactions = NULL;
+static wmem_tree_t *transactions = NULL;
static int ett_iso7816 = -1;
static int ett_iso7816_class = -1;
@@ -201,15 +202,6 @@ static const range_string iso7816_sw1[] = {
{ 0,0, NULL }
};
-
-static void
-iso7816_init(void)
-{
- transactions = se_tree_create_non_persistent(
- EMEM_TREE_TYPE_RED_BLACK, "iso7816_transactions");
-}
-
-
static int
dissect_iso7816_atr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@@ -511,7 +503,7 @@ dissect_iso7816_cmd_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (PINFO_FD_VISITED(pinfo)) {
- iso7816_trans = (iso7816_transaction_t *)se_tree_lookup32(
+ iso7816_trans = (iso7816_transaction_t *)wmem_tree_lookup32(
transactions, PINFO_FD_NUM(pinfo));
if (iso7816_trans && iso7816_trans->cmd_frame==PINFO_FD_NUM(pinfo) &&
iso7816_trans->resp_frame!=0) {
@@ -523,13 +515,12 @@ dissect_iso7816_cmd_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
else {
if (transactions) {
- iso7816_trans = (iso7816_transaction_t *)se_alloc(
- sizeof(iso7816_transaction_t));
+ iso7816_trans = wmem_new(wmem_file_scope(), iso7816_transaction_t);
iso7816_trans->cmd_frame = PINFO_FD_NUM(pinfo);
iso7816_trans->resp_frame = 0;
iso7816_trans->cmd_ins = INS_INVALID;
- se_tree_insert32(transactions,
+ wmem_tree_insert32(transactions,
iso7816_trans->cmd_frame, (void *)iso7816_trans);
}
}
@@ -597,7 +588,7 @@ dissect_iso7816_resp_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (transactions) {
/* receive the largest key that is less than or equal to our frame
number */
- iso7816_trans = (iso7816_transaction_t *)se_tree_lookup32_le(
+ iso7816_trans = (iso7816_transaction_t *)wmem_tree_lookup32_le(
transactions, PINFO_FD_NUM(pinfo));
if (iso7816_trans) {
if (iso7816_trans->resp_frame==0) {
@@ -845,7 +836,8 @@ proto_register_iso7816(void)
expert_register_field_array(expert_iso7816, ei, array_length(ei));
new_register_dissector("iso7816", dissect_iso7816, proto_iso7816);
- register_init_routine(iso7816_init);
+
+ transactions = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
proto_iso7816_atr = proto_register_protocol(
"ISO/IEC 7816-3", "ISO 7816-3", "iso7816.atr");
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index adfd3a6db4..f331816792 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -31,7 +31,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/conversation.h>
-#include <epan/emem.h>
+#include <epan/wmem/wmem.h>
#include <epan/dissectors/packet-smb.h>
#include <epan/strutil.h>
#include <epan/prefs.h>
@@ -1006,7 +1006,7 @@ feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb,packet_info *pinfo,guint16
/* Create a new tvb to point to the payload data */
data_tvb = tvb_new_subset(tvb, dataoffset, datalen, datalen);
/* Create the eo_info to pass to the listener */
- eo_info = ep_new(smb_eo_t);
+ eo_info = wmem_new(wmem_packet_scope(), smb_eo_t);
/* Try to get fid_info and tid_info */
if (fid_info == NULL) {
@@ -1021,7 +1021,7 @@ feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb,packet_info *pinfo,guint16
}
- tid_info = (smb_tid_info_t *)se_tree_lookup32(si->ct->tid_tree, si->tid);
+ tid_info = (smb_tid_info_t *)wmem_tree_lookup32(si->ct->tid_tree, si->tid);
/* Construct the eo_info structure */
eo_info->smbversion=1;
@@ -1029,21 +1029,21 @@ feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb,packet_info *pinfo,guint16
if (tid_info->filename) {
eo_info->hostname = tid_info->filename;
} else {
- eo_info->hostname = ep_strdup_printf("\\\\%s\\TREEID_UNKNOWN",tree_ip_str(pinfo,cmd));
+ eo_info->hostname = wmem_strdup_printf(wmem_packet_scope(), "\\\\%s\\TREEID_UNKNOWN",tree_ip_str(pinfo,cmd));
}
}
- else eo_info->hostname = ep_strdup_printf("\\\\%s\\TREEID_%i",tree_ip_str(pinfo,cmd),si->tid);
+ else eo_info->hostname = wmem_strdup_printf(wmem_packet_scope(), "\\\\%s\\TREEID_%i",tree_ip_str(pinfo,cmd),si->tid);
if (fid_info) {
eo_info->filename = NULL;
if (fid_info->fsi)
if (fid_info->fsi->filename)
eo_info->filename = (gchar *) fid_info->fsi->filename;
- if (!eo_info->filename) eo_info->filename = ep_strdup_printf("\\FILEID_%i",fid);
+ if (!eo_info->filename) eo_info->filename = wmem_strdup_printf(wmem_packet_scope(), "\\FILEID_%i",fid);
eo_info->fid_type = fid_info->type;
eo_info->end_of_file = fid_info->end_of_file;
} else {
eo_info->fid_type = SMB_FID_TYPE_UNKNOWN;
- eo_info->filename = ep_strdup_printf("\\FILEID_%i",fid);
+ eo_info->filename = wmem_strdup_printf(wmem_packet_scope(), "\\FILEID_%i",fid);
eo_info->end_of_file = 0;
}
if (eosmb_take_name_as_fid) {
@@ -2296,7 +2296,7 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
}
if (!pinfo->fd->flags.visited && si->sip) {
- dialects = (struct negprot_dialects *)se_alloc(sizeof(struct negprot_dialects));
+ dialects = wmem_new(wmem_file_scope(), struct negprot_dialects);
dialects->num = 0;
si->sip->extra_info_type = SMB_EI_DIALECTS;
si->sip->extra_info = dialects;
@@ -2330,7 +2330,7 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
COUNT_BYTES(len);
if (!pinfo->fd->flags.visited && dialects && (dialects->num < MAX_DIALECTS)) {
- dialects->name[dialects->num++] = se_strdup(str);
+ dialects->name[dialects->num++] = wmem_strdup(wmem_file_scope(), str);
}
}
@@ -2685,7 +2685,7 @@ dissect_old_dir_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
if ((!pinfo->fd->flags.visited) && si->sip) {
si->sip->extra_info_type = SMB_EI_FILENAME;
- si->sip->extra_info = se_strdup(dn);
+ si->sip->extra_info = wmem_strdup(wmem_file_scope(), dn);
}
if (dn == NULL)
@@ -2886,7 +2886,7 @@ dissect_smb_uid(tvbuff_t *tvb, proto_tree *parent_tree, int offset, smb_info_t *
item = proto_tree_add_uint(parent_tree, hf_smb_uid, tvb, offset, 2, si->uid);
tree = proto_item_add_subtree(item, ett_smb_uid);
- smb_uid = (smb_uid_t *)se_tree_lookup32(si->ct->uid_tree, si->uid);
+ smb_uid = (smb_uid_t *)wmem_tree_lookup32(si->ct->uid_tree, si->uid);
if (smb_uid) {
if (smb_uid->domain && smb_uid->account)
proto_item_append_text(item, " (");
@@ -2932,7 +2932,7 @@ dissect_smb_tid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
offset += 2;
if ((!pinfo->fd->flags.visited) && is_created) {
- tid_info = (smb_tid_info_t *)se_alloc(sizeof(smb_tid_info_t));
+ tid_info = wmem_new(wmem_file_scope(), smb_tid_info_t);
tid_info->opened_in = pinfo->fd->num;
tid_info->closed_in = 0;
tid_info->type = SMB_FID_TYPE_UNKNOWN;
@@ -2941,11 +2941,11 @@ dissect_smb_tid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
} else {
tid_info->filename = NULL;
}
- se_tree_insert32(si->ct->tid_tree, tid, tid_info);
+ wmem_tree_insert32(si->ct->tid_tree, tid, tid_info);
}
if (!tid_info) {
- tid_info = (smb_tid_info_t *)se_tree_lookup32_le(si->ct->tid_tree, tid);
+ tid_info = (smb_tid_info_t *)wmem_tree_lookup32_le(si->ct->tid_tree, tid);
}
if (!tid_info) {
return offset;
@@ -3325,8 +3325,8 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
* dissect_smb_fid() called from the response.
*/
if ((!pinfo->fd->flags.visited) && si->sip && fn) {
- fsi = se_new(smb_fid_saved_info_t);
- fsi->filename = se_strdup(fn);
+ fsi = wmem_new(wmem_file_scope(), smb_fid_saved_info_t);
+ fsi->filename = wmem_strdup(wmem_file_scope(), fn);
fsi->create_flags = 0;
fsi->access_mask = 0;
fsi->file_attributes = 0;
@@ -3617,7 +3617,7 @@ dissect_smb_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
col_append_fstr(pinfo->cinfo, COL_INFO, ", FID: 0x%04x", fid);
if ((!pinfo->fd->flags.visited) && is_created) {
- fid_info = (smb_fid_info_t *)se_alloc(sizeof(smb_fid_info_t));
+ fid_info = (smb_fid_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_fid_info_t));
fid_info->opened_in = pinfo->fd->num;
fid_info->closed_in = 0;
fid_info->type = SMB_FID_TYPE_UNKNOWN;
@@ -3630,7 +3630,7 @@ dissect_smb_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
}
/* We don't use the fid_tree anymore to access and
maintain the fid information of analyzed files.
- (was se_tree_insert32(si->ct->fid_tree, fid, fid_info);)
+ (was wmem_tree_insert32(si->ct->fid_tree, fid, fid_info);)
We'll use a single list instead to keep track of the
files (fid) opened.
Note that the insert_sorted function allows to insert duplicates
@@ -3643,7 +3643,7 @@ dissect_smb_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
if (!fid_info) {
/* we use the single linked list to access this fid_info
- (was fid_info = se_tree_lookup32(si->ct->fid_tree, fid);) */
+ (was fid_info = wmem_tree_lookup32(si->ct->fid_tree, fid);) */
GSL_iterator = si->ct->GSL_fid_info;
while (GSL_iterator) {
suspect_fid_info = (smb_fid_info_t *)GSL_iterator->data;
@@ -3946,8 +3946,8 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* dissect_smb_fid() called from the response.
*/
if ((!pinfo->fd->flags.visited) && si->sip && fn) {
- fsi = se_new(smb_fid_saved_info_t);
- fsi->filename = se_strdup(fn);
+ fsi = wmem_new(wmem_file_scope(), smb_fid_saved_info_t);
+ fsi->filename = wmem_strdup(wmem_file_scope(), fn);
fsi->create_flags = 0;
fsi->access_mask = 0;
fsi->file_attributes = file_attributes;
@@ -4020,7 +4020,7 @@ dissect_delete_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if ((!pinfo->fd->flags.visited) && si->sip) {
si->sip->extra_info_type = SMB_EI_FILENAME;
- si->sip->extra_info = se_strdup(fn);
+ si->sip->extra_info = wmem_strdup(wmem_file_scope(), fn);
}
if (fn == NULL)
@@ -4096,9 +4096,9 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* save the offset/len for this transaction */
if (si->sip && !pinfo->fd->flags.visited) {
- rni = (smb_rename_saved_info_t *)se_alloc(sizeof(smb_rename_saved_info_t));
- rni->old_name = se_strdup(old_name);
- rni->new_name = se_strdup(new_name);
+ rni = (smb_rename_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_rename_saved_info_t));
+ rni->old_name = wmem_strdup(wmem_file_scope(), old_name);
+ rni->new_name = wmem_strdup(wmem_file_scope(), new_name);
si->sip->extra_info_type = SMB_EI_RENAMEDATA;
si->sip->extra_info = rni;
@@ -4327,7 +4327,7 @@ dissect_read_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
/* save the offset/len for this transaction */
if (si->sip && !pinfo->fd->flags.visited) {
- rwi = se_new(rw_info_t);
+ rwi = wmem_new(wmem_file_scope(), rw_info_t);
rwi->offset = ofs;
rwi->len = cnt;
rwi->fid = fid;
@@ -4567,7 +4567,7 @@ dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* save the offset/len for this transaction */
if (si->sip && !pinfo->fd->flags.visited) {
- rwi = (rw_info_t *)se_alloc(sizeof(rw_info_t));
+ rwi = (rw_info_t *)wmem_alloc(wmem_file_scope(), sizeof(rw_info_t));
rwi->offset = ofs;
rwi->len = cnt;
rwi->fid = fid;
@@ -4980,7 +4980,7 @@ smbext20_timeout_msecs_to_str(gint32 timeout)
#define SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN 60
if (timeout <= 0) {
- buf = (gchar *)ep_alloc(SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1);
+ buf = (gchar *)wmem_alloc(wmem_packet_scope(), SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1);
if (timeout == 0) {
g_snprintf(buf, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1, "Return immediately (0)");
} else if (timeout == -1) {
@@ -5824,7 +5824,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* store the locking data for the response */
if ((!pinfo->fd->flags.visited) && si->sip) {
- ld = (smb_locking_saved_info_t *)se_alloc(sizeof(smb_locking_saved_info_t));
+ ld = (smb_locking_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_locking_saved_info_t));
ld->type = lt;
ld->oplock_level= ol;
ld->num_lock = num_lock;
@@ -5884,7 +5884,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* remember the unlock for the reply */
if (ld) {
smb_lock_info_t *li;
- li = (smb_lock_info_t *)se_alloc(sizeof(smb_lock_info_t));
+ li = (smb_lock_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_lock_info_t));
li->next = ld->unlocks;
ld->unlocks = li;
li->pid = lock_pid;
@@ -5965,7 +5965,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* remember the lock for the reply */
if (ld) {
smb_lock_info_t *li;
- li = (smb_lock_info_t *)se_alloc(sizeof(smb_lock_info_t));
+ li = (smb_lock_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_lock_info_t));
li->next = ld->locks;
ld->locks = li;
li->pid = lock_pid;
@@ -6290,8 +6290,8 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
if ((!pinfo->fd->flags.visited) && si->sip && fn) {
smb_fid_saved_info_t *fsi;
- fsi = (smb_fid_saved_info_t *)se_alloc(sizeof(smb_fid_saved_info_t));
- fsi->filename = se_strdup(fn);
+ fsi = (smb_fid_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_fid_saved_info_t));
+ fsi->filename = wmem_strdup(wmem_file_scope(), fn);
si->sip->extra_info_type = SMB_EI_FILEDATA;
si->sip->extra_info = fsi;
@@ -6605,7 +6605,7 @@ dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
/* save the offset/len for this transaction */
if (si->sip && !pinfo->fd->flags.visited) {
- rwi = (rw_info_t *)se_alloc(sizeof(rw_info_t));
+ rwi = (rw_info_t *)wmem_alloc(wmem_file_scope(), sizeof(rw_info_t));
rwi->offset = ofs;
rwi->len = maxcnt;
rwi->fid = fid;
@@ -6874,7 +6874,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* save the offset/len for this transaction */
if (si->sip && !pinfo->fd->flags.visited) {
- rwi = (rw_info_t *)se_alloc(sizeof(rw_info_t));
+ rwi = (rw_info_t *)wmem_alloc(wmem_file_scope(), sizeof(rw_info_t));
rwi->offset = ofs;
rwi->len = datalen;
rwi->fid = fid;
@@ -7255,11 +7255,11 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
if (ntlmssph && (ntlmssph->type == 3)) {
smb_uid_t *smb_uid;
- smb_uid = (smb_uid_t *)se_alloc(sizeof(smb_uid_t));
+ smb_uid = (smb_uid_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_uid_t));
smb_uid->logged_in=-1;
smb_uid->logged_out=-1;
- smb_uid->domain = se_strdup(ntlmssph->domain_name);
- smb_uid->account = se_strdup(ntlmssph->acct_name);
+ smb_uid->domain = wmem_strdup(wmem_file_scope(), ntlmssph->domain_name);
+ smb_uid->account = wmem_strdup(wmem_file_scope(), ntlmssph->acct_name);
si->sip->extra_info = smb_uid;
si->sip->extra_info_type = SMB_EI_UID;
@@ -7464,7 +7464,7 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre
smb_uid = (smb_uid_t *)si->sip->extra_info;
smb_uid->logged_in = pinfo->fd->num;
- se_tree_insert32(si->ct->uid_tree, si->uid, smb_uid);
+ wmem_tree_insert32(si->ct->uid_tree, si->uid, smb_uid);
}
/* next smb command */
@@ -7785,7 +7785,7 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
*/
if ((!pinfo->fd->flags.visited) && si->sip && an) {
si->sip->extra_info_type = SMB_EI_TIDNAME;
- si->sip->extra_info = se_strdup(an);
+ si->sip->extra_info = wmem_strdup(wmem_file_scope(), an);
}
col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s",
@@ -9088,7 +9088,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
* Allocate a new smb_nt_transact_info_t
* structure.
*/
- nti = (smb_nt_transact_info_t *)se_alloc(sizeof(smb_nt_transact_info_t));
+ nti = (smb_nt_transact_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_nt_transact_info_t));
nti->subcmd = subcmd;
nti->fid_type = SMB_FID_TYPE_UNKNOWN;
sip->extra_info = nti;
@@ -10292,8 +10292,8 @@ dissect_nt_create_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if ((!pinfo->fd->flags.visited) && si->sip && fn) {
smb_fid_saved_info_t *fsi;
- fsi = (smb_fid_saved_info_t *)se_alloc(sizeof(smb_fid_saved_info_t));
- fsi->filename = se_strdup(fn);
+ fsi = (smb_fid_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_fid_saved_info_t));
+ fsi->filename = wmem_strdup(wmem_file_scope(), fn);
fsi->create_flags = create_flags;
fsi->access_mask = access_mask;
fsi->file_attributes = file_attributes;
@@ -11075,7 +11075,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo,
fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc);
CHECK_STRING_TRANS(fn);
if (t2i && !t2i->name) {
- t2i->name = se_strdup(fn);
+ t2i->name = wmem_strdup(wmem_file_scope(), fn);
}
proto_tree_add_string(tree, hf_smb_search_pattern, tvb, offset, fn_len,
fn);
@@ -11183,7 +11183,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo,
fn);
COUNT_BYTES_TRANS(fn_len);
if (t2i && !t2i->name) {
- t2i->name = se_strdup(fn);
+ t2i->name = wmem_strdup(wmem_file_scope(), fn);
}
col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s",
@@ -14030,7 +14030,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* smb_transact2_info_t
* structure.
*/
- t2i = (smb_transact2_info_t *)se_alloc(sizeof(smb_transact2_info_t));
+ t2i = (smb_transact2_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_transact2_info_t));
t2i->subcmd = subcmd;
t2i->info_level = -1;
t2i->resume_keys = FALSE;
@@ -14182,7 +14182,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* Allocate a new smb_transact_info_t
* structure.
*/
- tri = (smb_transact_info_t *)se_alloc(sizeof(smb_transact_info_t));
+ tri = (smb_transact_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_transact_info_t));
tri->subcmd = -1;
tri->trans_subcmd = -1;
tri->function = -1;
@@ -17654,7 +17654,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
conversation_t *conversation;
nstime_t t, deltat;
- si = (smb_info_t *)ep_alloc0(sizeof(smb_info_t));
+ si = wmem_new0(wmem_packet_scope(), smb_info_t);
top_tree_global = parent_tree;
@@ -17724,9 +17724,9 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
smb_saved_info_equal_unmatched);
si->ct->raw_ntlmssp = 0;
- si->ct->fid_tree = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SMB fid_tree");
- si->ct->tid_tree = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SMB tid_tree");
- si->ct->uid_tree = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SMB uid_tree");
+ si->ct->fid_tree = wmem_tree_new(wmem_file_scope());
+ si->ct->tid_tree = wmem_tree_new(wmem_file_scope());
+ si->ct->uid_tree = wmem_tree_new(wmem_file_scope());
/* Initialize the GSL_fid_info for this ct */
si->ct->GSL_fid_info = NULL;
conversation_add_proto_data(conversation, proto_smb, si->ct);
@@ -17779,7 +17779,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
*/
sip = (smb_saved_info_t *)g_hash_table_lookup(si->ct->unmatched, GUINT_TO_POINTER(pid_mid));
if (sip!=NULL) {
- new_key = (smb_saved_info_key_t *)se_alloc(sizeof(smb_saved_info_key_t));
+ new_key = (smb_saved_info_key_t *)wmem_alloc(wmem_file_scope(), 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,
@@ -17908,7 +17908,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 = (smb_saved_info_key_t *)se_alloc(sizeof(smb_saved_info_key_t));
+ new_key = (smb_saved_info_key_t *)wmem_alloc(wmem_file_scope(), 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);
@@ -17943,7 +17943,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
}
}
if (si->request) {
- sip = (smb_saved_info_t *)se_alloc(sizeof(smb_saved_info_t));
+ sip = (smb_saved_info_t *)wmem_alloc(wmem_file_scope(), sizeof(smb_saved_info_t));
sip->frame_req = pinfo->fd->num;
sip->frame_res = 0;
sip->req_time = pinfo->fd->abs_ts;
@@ -17958,7 +17958,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
sip->fid = 0;
sip->fid_seen_in_request = 0;
g_hash_table_insert(si->ct->unmatched, GUINT_TO_POINTER(pid_mid), sip);
- new_key = (smb_saved_info_key_t *)se_alloc(sizeof(smb_saved_info_key_t));
+ new_key = (smb_saved_info_key_t *)wmem_alloc(wmem_file_scope(), 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-smb.h b/epan/dissectors/packet-smb.h
index a048e92a06..0972c87c37 100644
--- a/epan/dissectors/packet-smb.h
+++ b/epan/dissectors/packet-smb.h
@@ -28,6 +28,8 @@
#include "ws_symbol_export.h"
+#include <epan/wmem/wmem.h>
+
WS_DLL_PUBLIC gboolean sid_name_snooping;
/* SMB command codes, from the SNIA CIFS spec. With MSVC and a
@@ -290,15 +292,15 @@ typedef struct conv_tables {
gboolean raw_ntlmssp; /* Do extended security exc use raw ntlmssp */
/* track fid to fidstruct (filename/openframe/closeframe */
- emem_tree_t *fid_tree;
+ wmem_tree_t *fid_tree;
/* We'll use a GSL list instead */
GSList *GSL_fid_info;
/* track tid to fidstruct (sharename/shareframe/unshareframe */
- emem_tree_t *tid_tree;
+ wmem_tree_t *tid_tree;
/* track uid to username mappings */
- emem_tree_t *uid_tree;
+ wmem_tree_t *uid_tree;
} conv_tables_t;
typedef struct smb_info {
diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c
index a78b830081..29d65698f8 100644
--- a/epan/dissectors/packet-stun.c
+++ b/epan/dissectors/packet-stun.c
@@ -42,6 +42,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/ipproto.h>
+#include <epan/wmem/wmem.h>
#include <packet-tcp.h>
#include <packet-udp.h>
@@ -119,7 +120,7 @@ typedef struct _stun_transaction_t {
/* Structure containing conversation specific information */
typedef struct _stun_conv_info_t {
- emem_tree_t *transaction_pdus;
+ wmem_tree_t *transaction_pdus;
} stun_conv_info_t;
@@ -410,7 +411,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole
conversation_t *conversation=NULL;
stun_conv_info_t *stun_info;
stun_transaction_t *stun_trans;
- emem_tree_key_t transaction_id_key[2];
+ wmem_tree_key_t transaction_id_key[2];
guint32 transaction_id[3];
/*
@@ -481,14 +482,14 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole
/* No. Attach that information to the conversation, and add
* it to the list of information structures.
*/
- stun_info = se_new(stun_conv_info_t);
- stun_info->transaction_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "stun_transaction_pdus");
+ stun_info = wmem_new(wmem_file_scope(), stun_conv_info_t);
+ stun_info->transaction_pdus=wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conversation, proto_stun, stun_info);
}
if (!pinfo->fd->flags.visited) {
if ((stun_trans = (stun_transaction_t *)
- se_tree_lookup32_array(stun_info->transaction_pdus,
+ wmem_tree_lookup32_array(stun_info->transaction_pdus,
transaction_id_key)) == NULL) {
transaction_id_key[0].length = 3;
@@ -496,11 +497,11 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole
transaction_id_key[1].length = 0;
transaction_id_key[1].key = NULL;
- stun_trans=se_new(stun_transaction_t);
+ stun_trans=wmem_new(wmem_file_scope(), stun_transaction_t);
stun_trans->req_frame=0;
stun_trans->rep_frame=0;
stun_trans->req_time=pinfo->fd->abs_ts;
- se_tree_insert32_array(stun_info->transaction_pdus,
+ wmem_tree_insert32_array(stun_info->transaction_pdus,
transaction_id_key,
(void *)stun_trans);
}
@@ -519,13 +520,13 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole
}
} else {
- stun_trans=(stun_transaction_t *)se_tree_lookup32_array(stun_info->transaction_pdus,
+ stun_trans=(stun_transaction_t *)wmem_tree_lookup32_array(stun_info->transaction_pdus,
transaction_id_key);
}
if (!stun_trans) {
/* create a "fake" pana_trans structure */
- stun_trans=ep_new(stun_transaction_t);
+ stun_trans=wmem_new(wmem_packet_scope(), stun_transaction_t);
stun_trans->req_frame=0;
stun_trans->rep_frame=0;
stun_trans->req_time=pinfo->fd->abs_ts;