Convert a few more dissectors to wmem API

svn path=/trunk/; revision=52053
This commit is contained in:
Pascal Quantin 2013-09-15 10:29:49 +00:00
parent 07c29e74e9
commit 868b345eea
12 changed files with 122 additions and 114 deletions

View File

@ -81,7 +81,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#----------------------------------------------------------------------------------------
#.FN_HDR MultiplexElement
/*MultiplexElement*/
h223_mux_element* me = se_new(h223_mux_element);
h223_mux_element* me = wmem_new(wmem_file_scope(), h223_mux_element);
h223_me->next = me;
h223_me = me;
h223_me->next = NULL;
@ -129,7 +129,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#.FN_BODY OpenLogicalChannel
gint32 temp;
upcoming_olc = (!actx->pinfo->fd->flags.visited) ? se_new0(olc_info_t) : NULL;
upcoming_olc = (!actx->pinfo->fd->flags.visited) ? wmem_new0(wmem_file_scope(), olc_info_t) : NULL;
h223_fw_lc_num = 0;
h223_lc_params_temp = NULL;
@ -137,7 +137,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
%(DEFAULT_BODY)s
if(h223_fw_lc_num != 0 && h223_fw_lc_params) {
h223_pending_olc *pending = se_new(h223_pending_olc);
h223_pending_olc *pending = wmem_new(wmem_file_scope(), h223_pending_olc);
pending->fw_channel_params = h223_fw_lc_params;
pending->rev_channel_params = h223_rev_lc_params;
temp = h223_fw_lc_num;
@ -150,7 +150,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
h245_setup_channels(actx->pinfo, &upcoming_olc->rev_lc);
} else {
g_hash_table_insert(h245_pending_olc_reqs,
se_strdup(gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->dst, &%(ACTX)s->pinfo->src)),
wmem_strdup(wmem_file_scope(), gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->dst, &%(ACTX)s->pinfo->src)),
upcoming_olc);
}
}
@ -183,7 +183,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#.END
#----------------------------------------------------------------------------------------
#.FN_HDR OpenLogicalChannel/forwardLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters
h223_fw_lc_params = se_new(h223_lc_params);
h223_fw_lc_params = wmem_new(wmem_file_scope(), h223_lc_params);
h223_fw_lc_params->al_type = al_nonStandard;
h223_fw_lc_params->al_params = NULL;
h223_fw_lc_params->segmentable = 0;
@ -204,7 +204,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#.END
#----------------------------------------------------------------------------------------
#.FN_HDR OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters
h223_rev_lc_params = se_new(h223_lc_params);
h223_rev_lc_params = wmem_new(wmem_file_scope(), h223_lc_params);
h223_rev_lc_params->al_type = al_nonStandard;
h223_rev_lc_params->al_params = NULL;
h223_rev_lc_params->segmentable = 0;
@ -314,7 +314,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al3
if(h223_lc_params_temp) {
h223_lc_params_temp->al_type = al3;
h223_lc_params_temp->al_params = se_new(h223_al3_params);
h223_lc_params_temp->al_params = wmem_new(wmem_file_scope(), h223_al3_params);
}
#.END
#----------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/wmem/wmem.h>
#include <epan/dissectors/packet-tcp.h>
@ -548,7 +549,7 @@ gadu_gadu_create_conversation(packet_info *pinfo, guint32 uin)
conv = find_or_create_conversation(pinfo);
gg_conv = (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, hfi_gadu_gadu->id);
if (!gg_conv) {
gg_conv = se_new(struct gadu_gadu_conv_data);
gg_conv = wmem_new(wmem_file_scope(), struct gadu_gadu_conv_data);
gg_conv->uin = uin;
conversation_add_proto_data(conv, hfi_gadu_gadu->id, gg_conv);
@ -604,26 +605,26 @@ dissect_gadu_gadu_stringz_cp1250(tvbuff_t *tvb, const header_field_info *hfi, pr
const int org_offset = offset;
emem_strbuf_t *str;
wmem_strbuf_t *str;
guint8 ch;
gint len;
len = tvb_reported_length_remaining(tvb, offset);
str = ep_strbuf_new("");
str = wmem_strbuf_new(wmem_packet_scope(), "");
while ((len > 0) && (ch = tvb_get_guint8(tvb, offset))) {
if (ch < 0x80)
ep_strbuf_append_c(str, ch);
wmem_strbuf_append_c(str, ch);
else
ep_strbuf_append_unichar(str, table_cp1250[ch-0x80]);
wmem_strbuf_append_unichar(str, table_cp1250[ch-0x80]);
offset++;
len--;
}
if (len > 0)
offset++; /* NUL */
proto_tree_add_unicode_string(tree, hfi->id, tvb, org_offset, offset - org_offset, str->str);
proto_tree_add_unicode_string(tree, hfi->id, tvb, org_offset, offset - org_offset, wmem_strbuf_get_str(str));
return offset;
}

View File

@ -291,7 +291,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/prefs.h>
#include <epan/expert.h>
@ -1030,12 +1030,12 @@ static const char *giop_ior_file = "IOR.txt";
static GList *insert_in_comp_req_list(GList *list, guint32 fn, guint32 reqid, const gchar * op, giop_sub_handle_t *sh ) {
comp_req_list_entry_t * entry;
entry = se_new(comp_req_list_entry_t);
entry = wmem_new(wmem_file_scope(), comp_req_list_entry_t);
entry->fn = fn;
entry->reqid = reqid;
entry->subh = sh;
entry->operation = se_strdup(op); /* duplicate operation for storage */
entry->operation = wmem_strdup(wmem_file_scope(), op); /* duplicate operation for storage */
entry->repoid = NULL; /* dont have yet */
return g_list_append (list, entry); /* append */
@ -1132,10 +1132,10 @@ static void insert_in_complete_reply_hash(guint32 fn, guint32 mfn) {
return; /* FN collision */
}
new_key = se_new(struct complete_reply_hash_key);
new_key = wmem_new(wmem_file_scope(), struct complete_reply_hash_key);
new_key->fn = fn; /* save FN */
val = se_new(struct complete_reply_hash_val);
val = wmem_new(wmem_file_scope(), struct complete_reply_hash_val);
val->mfn = mfn; /* and MFN */
g_hash_table_insert(giop_complete_reply_hash, new_key, val);
@ -1381,12 +1381,12 @@ static void insert_in_objkey_hash(GHashTable *hash, const gchar *obj, guint32 le
/* So, passed key should NOT exist in hash at this point.*/
new_objkey_key = se_new(struct giop_object_key);
new_objkey_key = wmem_new(wmem_file_scope(), struct giop_object_key);
new_objkey_key->objkey_len = len; /* save it */
new_objkey_key->objkey = (guint8 *) se_memdup(obj,len); /* copy from object and allocate ptr */
new_objkey_key->objkey = (guint8 *) wmem_memdup(wmem_file_scope(), obj,len); /* copy from object and allocate ptr */
objkey_val = se_new(struct giop_object_val);
objkey_val->repo_id = se_strdup(repoid); /* duplicate and store Respository ID string */
objkey_val = wmem_new(wmem_file_scope(), struct giop_object_val);
objkey_val->repo_id = wmem_strdup(wmem_file_scope(), repoid); /* duplicate and store Respository ID string */
objkey_val->src = src; /* where IOR came from */
@ -1448,7 +1448,7 @@ static guint32 string_to_IOR(guchar *in, guint32 in_len, guint8 **out){
gint8 tmpval; /* complete value */
guint32 i;
*out = ep_alloc_array0(guint8, in_len); /* allocate buffer */
*out = wmem_alloc0_array(wmem_packet_scope(), guint8, in_len); /* allocate buffer */
if (*out == NULL) {
return 0;
@ -1525,7 +1525,7 @@ static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) {
return;
}
buf = (guchar *)ep_alloc0(max_iorlen+1); /* input buf */
buf = (guchar *)wmem_alloc0(wmem_packet_scope(), max_iorlen+1); /* input buf */
while ((len = giop_getline(fp,buf,max_iorlen+1)) > 0) {
my_offset = 0; /* reset for every IOR read */
@ -2074,7 +2074,7 @@ gchar * make_printable_string (const gchar *in, guint32 len) {
guint32 i = 0;
gchar *print_string = NULL;
print_string = (gchar * )ep_alloc0(len + 1); /* make some space and zero it */
print_string = (gchar * )wmem_alloc0(wmem_packet_scope(), len + 1); /* make some space and zero it */
memcpy(print_string, in, len); /* and make a copy of input data */
for(i=0; i < len; i++) {
@ -2961,7 +2961,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar **
printf("giop:get_CDR_fixed(): slen = %.2x \n", slen);
#endif
tmpbuf = (gchar *)ep_alloc0(slen); /* allocate temp buffer */
tmpbuf = (gchar *)wmem_alloc0(wmem_packet_scope(), slen); /* allocate temp buffer */
/* If even , grab 1st dig */
@ -3016,8 +3016,8 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar **
*/
sindex = 0; /* reset */
*seq = ep_alloc_array0(gchar, slen + 3); /* allocate temp buffer , including space for sign, decimal point and
* \0 -- TODO check slen is reasonable first */
*seq = wmem_alloc0_array(wmem_packet_scope(), gchar, slen + 3); /* allocate temp buffer , including space for sign, decimal point and
* \0 -- TODO check slen is reasonable first */
#if DEBUG
printf("giop:get_CDR_fixed(): sign = %.2x \n", sign);
#endif
@ -3220,7 +3220,7 @@ void get_CDR_octet_seq(tvbuff_t *tvb, const gchar **seq, int *offset, guint32 le
* allocating the buffer, so that we don't try to allocate a buffer bigger
* than the data we'll actually be copying, and thus don't run the risk
* of crashing if the buffer is *so* big that we fail to allocate it
* and "ep_alloc_array0()" aborts.
* and "wmem_alloc0_array()" aborts.
*/
tvb_ensure_bytes_exist(tvb, *offset, len);
@ -3229,7 +3229,7 @@ void get_CDR_octet_seq(tvbuff_t *tvb, const gchar **seq, int *offset, guint32 le
* do what we do now, and null-terminate the string (which also means
* we don't need to zero out the entire allocation, just the last byte)?
*/
seq_buf = ep_alloc_array0(gchar, len + 1);
seq_buf = wmem_alloc0_array(wmem_packet_scope(), gchar, len + 1);
tvb_memcpy( tvb, seq_buf, *offset, len);
*seq = seq_buf;
*offset += len;
@ -3317,7 +3317,7 @@ guint32 get_CDR_string(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean s
else if (slength > 0) {
get_CDR_octet_seq(tvb, seq, offset, slength);
} else {
*seq = ep_strdup(""); /* zero-length string */
*seq = wmem_strdup(wmem_packet_scope(), ""); /* zero-length string */
}
return slength; /* return length */

View File

@ -33,6 +33,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/wmem/wmem.h>
#include "packet-csn1.h"
@ -1047,7 +1048,7 @@ dissect_gmr1_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* SI1 or SI2 */
if (is_si1) {
SystemInformation1_t *data;
data = ep_new(SystemInformation1_t);
data = wmem_new(wmem_packet_scope(), SystemInformation1_t);
csnStreamDissector(bcch_tree, &ar, CSNDESCR(SystemInformation1_t), tvb, data, ett_gmr1_bcch);
col_append_fstr(
pinfo->cinfo, COL_INFO,
@ -1056,7 +1057,7 @@ dissect_gmr1_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
);
} else {
SystemInformation2_t *data;
data = ep_new(SystemInformation2_t);
data = wmem_new(wmem_packet_scope(), SystemInformation2_t);
csnStreamDissector(bcch_tree, &ar, CSNDESCR(SystemInformation2_t), tvb, data, ett_gmr1_bcch);
col_append_fstr(
pinfo->cinfo, COL_INFO,

View File

@ -32,7 +32,7 @@
#include <epan/packet.h>
#include <epan/tap.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include "packet-bssap.h"
#include "packet-sccp.h"
@ -948,7 +948,9 @@ dissect_bssmap_le(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
str = try_val_to_str_idx((guint32) oct, gsm_bssmap_le_msg_strings, &idx);
if (sccp_msg_p && !sccp_msg_p->data.co.label) {
sccp_msg_p->data.co.label = se_strdup(val_to_str((guint32) oct, gsm_bssmap_le_msg_strings, "BSSMAP LE(0x%02x)"));
sccp_msg_p->data.co.label = wmem_strdup(wmem_file_scope(),
val_to_str((guint32) oct,
gsm_bssmap_le_msg_strings, "BSSMAP LE(0x%02x)"));
}
/*

View File

@ -2714,7 +2714,7 @@ dis_field_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset
}
/* Store udl and length for later decoding of reassembled SMS */
p_frag_params = se_new0(sm_fragment_params);
p_frag_params = wmem_new0(wmem_file_scope(), sm_fragment_params);
p_frag_params->udl = udl;
p_frag_params->fill_bits = fill_bits;
p_frag_params->length = length;

View File

@ -56,6 +56,7 @@
#include <epan/conversation.h>
#include <epan/packet.h>
#include <epan/wmem/wmem.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/sminmpec.h>
@ -3091,7 +3092,7 @@ gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint
}
/* if we cant reuse the old one, grab a new chunk */
if (!gcrp) {
gcrp = se_new(gtp_msg_hash_t);
gcrp = wmem_new(wmem_file_scope(), gtp_msg_hash_t);
}
gcrp->seq_nr=seq_nr;
gcrp->req_frame = pinfo->fd->num;
@ -7860,7 +7861,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
/* Setting everything to 0, so that the TEID is 0 for GTP version 0
* The magic number should perhaps be replaced.
*/
gtp_hdr = ep_new0(gtp_hdr_t);
gtp_hdr = wmem_new0(wmem_packet_scope(), gtp_hdr_t);
/* Setting the TEID to -1 to say that the TEID is not valid for this packet */
gtp_hdr->teid = -1;

View File

@ -48,6 +48,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/wmem/wmem.h>
#define GVCP_PORT 3956
@ -108,7 +109,7 @@ static int
dissect_gvcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint16 packet_type, packet_opcode, packet_plsize;
emem_strbuf_t *info;
wmem_strbuf_t *info;
/* Check that there's enough data */
if (tvb_length(tvb) < 8)
@ -141,24 +142,24 @@ dissect_gvcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
packet_plsize = tvb_get_ntohs(tvb, 4);
/* allocate growable info string */
info = ep_strbuf_new(val_to_str(packet_opcode, opcode_names, "Unknown opcode (0x%04x)"));
info = wmem_strbuf_new(wmem_packet_scope(), val_to_str(packet_opcode, opcode_names, "Unknown opcode (0x%04x)"));
/* check that GVCP header+payload match total packet size */
if (tvb_reported_length(tvb) < 8+(guint32)packet_plsize) {
ep_strbuf_append_printf(info, " (truncated? %u bytes missing)",
(8 + packet_plsize) - tvb_reported_length(tvb));
col_add_str(pinfo->cinfo, COL_INFO, info->str);
wmem_strbuf_append_printf(info, " (truncated? %u bytes missing)",
(8 + packet_plsize) - tvb_reported_length(tvb));
col_add_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(info));
return tvb_length(tvb);/* or should we assume this is not GVCP, return 0?*/
}
if (tvb_reported_length(tvb) > 8+(guint32)packet_plsize) {
ep_strbuf_append_printf(info, " (%u excess bytes)",
tvb_reported_length(tvb) - (8 + packet_plsize));
col_add_str(pinfo->cinfo, COL_INFO, info->str);
wmem_strbuf_append_printf(info, " (%u excess bytes)",
tvb_reported_length(tvb) - (8 + packet_plsize));
col_add_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(info));
return tvb_length(tvb);/* or should we assume this is not GVCP, return 0?*/
}
if (packet_plsize & 3) {/* payload is always a multiple of 4 bytes */
ep_strbuf_append(info, " (payload is not multiple of 4 bytes)");
col_add_str(pinfo->cinfo, COL_INFO, info->str);
wmem_strbuf_append(info, " (payload is not multiple of 4 bytes)");
col_add_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(info));
return tvb_length(tvb);/* or should we assume this is not GVCP, return 0?*/
}
@ -167,88 +168,88 @@ dissect_gvcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
switch (packet_opcode) {
case 0x04: /* Assign new temporary IP */
if (packet_plsize < 24) {/* 56 bytes seem to be normal */
ep_strbuf_append(info, " <missing args>");
wmem_strbuf_append(info, " <missing args>");
} else { /* packet contain new network configuration */
ep_strbuf_append_printf(info, "%d.%d.%d.%d to %s",
tvb_get_guint8(tvb, 28), tvb_get_guint8(tvb, 29),
tvb_get_guint8(tvb, 30), tvb_get_guint8(tvb, 31),
tvb_bytes_to_str_punct(tvb, 10, 6, ':'));
wmem_strbuf_append_printf(info, "%d.%d.%d.%d to %s",
tvb_get_guint8(tvb, 28), tvb_get_guint8(tvb, 29),
tvb_get_guint8(tvb, 30), tvb_get_guint8(tvb, 31),
tvb_bytes_to_str_punct(tvb, 10, 6, ':'));
}
break;
case 0x80: /* Register Read Request */
case 0x81: /* Register Read Answer */
if (packet_plsize == 0) {
ep_strbuf_append(info, " <missing arg(s)>");
wmem_strbuf_append(info, " <missing arg(s)>");
} else { /* packet contains address(es) to read from */
ep_strbuf_append_printf(info, " 0x%08x", tvb_get_ntohl(tvb, 8));
wmem_strbuf_append_printf(info, " 0x%08x", tvb_get_ntohl(tvb, 8));
if (packet_plsize >= 8) {
ep_strbuf_append_printf(info, ", 0x%08x", tvb_get_ntohl(tvb, 12));
wmem_strbuf_append_printf(info, ", 0x%08x", tvb_get_ntohl(tvb, 12));
if (packet_plsize >= 12)
ep_strbuf_append(info, ", ...");
wmem_strbuf_append(info, ", ...");
}
}
break;
case 0x82: /* Register Write Request */
if (packet_plsize < 8) {
ep_strbuf_append(info, " <missing arg(s)>");
wmem_strbuf_append(info, " <missing arg(s)>");
} else { /* packet contains address/value pairs to read from */
ep_strbuf_append_printf(info, " *0x%08x = 0x%08x", tvb_get_ntohl(tvb, 8),
tvb_get_ntohl(tvb, 12));
wmem_strbuf_append_printf(info, " *0x%08x = 0x%08x", tvb_get_ntohl(tvb, 8),
tvb_get_ntohl(tvb, 12));
if (packet_plsize >= 16) {
ep_strbuf_append_printf(info, ", *0x%08x = 0x%08x",
tvb_get_ntohl(tvb, 16), tvb_get_ntohl(tvb, 20));
wmem_strbuf_append_printf(info, ", *0x%08x = 0x%08x",
tvb_get_ntohl(tvb, 16), tvb_get_ntohl(tvb, 20));
if (packet_plsize >= 24)
ep_strbuf_append(info, ", ...");
wmem_strbuf_append(info, ", ...");
}
}
break;
case 0x83: /* Register Write Answer */
if (packet_plsize < 4) {
ep_strbuf_append(info, " <missing arg>");
wmem_strbuf_append(info, " <missing arg>");
} else {
ep_strbuf_append_printf(info, " %d register%s written",
tvb_get_ntohl(tvb, 8),
tvb_get_ntohl(tvb, 8)==1?"":"s");
wmem_strbuf_append_printf(info, " %d register%s written",
tvb_get_ntohl(tvb, 8),
tvb_get_ntohl(tvb, 8)==1?"":"s");
}
break;
case 0x84: /* Block Read Request */
if (packet_plsize < 8) {
ep_strbuf_append(info, " <missing args>");
wmem_strbuf_append(info, " <missing args>");
} else { /* packet contains address/size pair to read from */
ep_strbuf_append_printf(info, " 0x%08x (%d bytes, X=0x%04x)",
tvb_get_ntohl(tvb, 8), tvb_get_ntohs(tvb, 14),
tvb_get_ntohs(tvb, 12));
wmem_strbuf_append_printf(info, " 0x%08x (%d bytes, X=0x%04x)",
tvb_get_ntohl(tvb, 8), tvb_get_ntohs(tvb, 14),
tvb_get_ntohs(tvb, 12));
if (packet_plsize > 8) {
ep_strbuf_append(info, "; excess payload");
wmem_strbuf_append(info, "; excess payload");
}
}
break;
case 0x85: /* Block Read Answer */
if (packet_plsize < 8) {
ep_strbuf_append(info, " <missing args>");
wmem_strbuf_append(info, " <missing args>");
} else { /* packet contains desired data */
ep_strbuf_append_printf(info, " %d bytes from 0x%08x", packet_plsize - 4,
tvb_get_ntohl(tvb, 8));
wmem_strbuf_append_printf(info, " %d bytes from 0x%08x", packet_plsize - 4,
tvb_get_ntohl(tvb, 8));
}
break;
case 0x86: /* Block Write Request */
if (packet_plsize < 8) {
ep_strbuf_append(info, " <missing args>");
wmem_strbuf_append(info, " <missing args>");
} else { /* packet contains desired data */
ep_strbuf_append_printf(info, " *0x%08x = <%d bytes>",
tvb_get_ntohl(tvb, 8), packet_plsize - 4);
wmem_strbuf_append_printf(info, " *0x%08x = <%d bytes>",
tvb_get_ntohl(tvb, 8), packet_plsize - 4);
}
break;
case 0x87: /* Block Write Answer */
if (packet_plsize < 4) {
ep_strbuf_append(info, " <missing arg>");
wmem_strbuf_append(info, " <missing arg>");
} else {
ep_strbuf_append_printf(info, " %d bytes written", tvb_get_ntohl(tvb, 8));
wmem_strbuf_append_printf(info, " %d bytes written", tvb_get_ntohl(tvb, 8));
}
break;
}
col_add_str(pinfo->cinfo, COL_INFO, info->str);
col_add_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(info));
if (tree) { /* we are being asked for details */
proto_item *ti = NULL;

View File

@ -7390,7 +7390,7 @@ dissect_h245_T_h223_al_type_al3(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
#line 315 "../../asn1/h245/h245.cnf"
if(h223_lc_params_temp) {
h223_lc_params_temp->al_type = al3;
h223_lc_params_temp->al_params = se_new(h223_al3_params);
h223_lc_params_temp->al_params = wmem_new(wmem_file_scope(), h223_al3_params);
}
offset = dissect_h245_Al3(tvb, offset, actx, tree, hf_index);
@ -7800,7 +7800,7 @@ dissect_h245_H223LogicalChannelParameters(tvbuff_t *tvb _U_, int offset _U_, asn
static int
dissect_h245_OLC_fw_h223_params(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 186 "../../asn1/h245/h245.cnf"
h223_fw_lc_params = se_new(h223_lc_params);
h223_fw_lc_params = wmem_new(wmem_file_scope(), h223_lc_params);
h223_fw_lc_params->al_type = al_nonStandard;
h223_fw_lc_params->al_params = NULL;
h223_fw_lc_params->segmentable = 0;
@ -8431,7 +8431,7 @@ dissect_h245_T_forwardLogicalChannelParameters(tvbuff_t *tvb _U_, int offset _U_
static int
dissect_h245_OLC_rev_h223_params(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 207 "../../asn1/h245/h245.cnf"
h223_rev_lc_params = se_new(h223_lc_params);
h223_rev_lc_params = wmem_new(wmem_file_scope(), h223_lc_params);
h223_rev_lc_params->al_type = al_nonStandard;
h223_rev_lc_params->al_params = NULL;
h223_rev_lc_params->segmentable = 0;
@ -8694,7 +8694,7 @@ dissect_h245_OpenLogicalChannel(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
#line 130 "../../asn1/h245/h245.cnf"
gint32 temp;
upcoming_olc = (!actx->pinfo->fd->flags.visited) ? se_new0(olc_info_t) : NULL;
upcoming_olc = (!actx->pinfo->fd->flags.visited) ? wmem_new0(wmem_file_scope(), olc_info_t) : NULL;
h223_fw_lc_num = 0;
h223_lc_params_temp = NULL;
@ -8704,7 +8704,7 @@ dissect_h245_OpenLogicalChannel(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
if(h223_fw_lc_num != 0 && h223_fw_lc_params) {
h223_pending_olc *pending = se_new(h223_pending_olc);
h223_pending_olc *pending = wmem_new(wmem_file_scope(), h223_pending_olc);
pending->fw_channel_params = h223_fw_lc_params;
pending->rev_channel_params = h223_rev_lc_params;
temp = h223_fw_lc_num;
@ -8717,7 +8717,7 @@ dissect_h245_OpenLogicalChannel(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
h245_setup_channels(actx->pinfo, &upcoming_olc->rev_lc);
} else {
g_hash_table_insert(h245_pending_olc_reqs,
se_strdup(gen_olc_key(upcoming_olc->fwd_lc_num, &actx->pinfo->dst, &actx->pinfo->src)),
wmem_strdup(wmem_file_scope(), gen_olc_key(upcoming_olc->fwd_lc_num, &actx->pinfo->dst, &actx->pinfo->src)),
upcoming_olc);
}
}
@ -8980,7 +8980,7 @@ static int
dissect_h245_MultiplexElement(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 83 "../../asn1/h245/h245.cnf"
/*MultiplexElement*/
h223_mux_element* me = se_new(h223_mux_element);
h223_mux_element* me = wmem_new(wmem_file_scope(), h223_mux_element);
h223_me->next = me;
h223_me = me;
h223_me->next = NULL;

View File

@ -27,6 +27,8 @@
#include "config.h"
#include <epan/wmem/wmem.h>
#include "packet-h248.h"
#define PNAME "H.248 Annex C"
#define PSNAME "H248C"
@ -763,7 +765,7 @@ static void dissect_h248_annexc_BIR(proto_tree* tree,
dissect_ber_octet_string(implicit_p ? *((gboolean*)implicit_p) : FALSE, &asn1_ctx, tree, tvb, 0, hfid, &new_tvb);
if ( new_tvb && h248_info->term && ! h248_info->term->bir ) {
h248_info->term->bir = se_strdup(tvb_bytes_to_str(new_tvb,0,tvb_length(new_tvb)));
h248_info->term->bir = wmem_strdup(wmem_file_scope(), tvb_bytes_to_str(new_tvb,0,tvb_length(new_tvb)));
}
}
@ -781,7 +783,7 @@ static void dissect_h248_annexc_NSAP(proto_tree* tree,
if (new_tvb) {
dissect_nsap(new_tvb, 0,tvb_length(new_tvb), tree);
if ( h248_info->term && ! h248_info->term->nsap) {
h248_info->term->nsap = se_strdup(tvb_bytes_to_str(new_tvb,0,tvb_length(new_tvb)));
h248_info->term->nsap = wmem_strdup(wmem_file_scope(), tvb_bytes_to_str(new_tvb,0,tvb_length(new_tvb)));
}
}
}

View File

@ -33,6 +33,7 @@
#include <epan/stats_tree.h>
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/wmem/wmem.h>
#include "packet-tcp.h"
static dissector_handle_t hartip_tcp_handle;
@ -388,7 +389,7 @@ dissect_string(proto_tree *tree, int hf, const char *name, int len,
proto_item *ti;
char *str;
str = (char *)ep_alloc(256);
str = (char *)wmem_alloc(wmem_packet_scope(), 256);
ti = proto_tree_add_item(tree, hf, tvb, offset, len, ENC_NA);
if (len < 256) {
@ -414,12 +415,12 @@ dissect_packAscii(proto_tree *tree, int hf, const char *name, int len,
guint8 *tmp;
char *str = NULL;
str = (char *)ep_alloc(256+1);
str = (char *)wmem_alloc(wmem_packet_scope(), 256+1);
ti = proto_tree_add_item(tree, hf, tvb, offset, len, ENC_NA);
DISSECTOR_ASSERT(len < 3 * (256/4));
tmp = (guint8 *)ep_alloc0(len);
tmp = (guint8 *)wmem_alloc0(wmem_packet_scope(), len);
tvb_memcpy(tvb, tmp, offset, len);
iIndex = 0;
@ -880,7 +881,7 @@ dissect_hartip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset++;
/* Setup statistics for tap. */
tapinfo = ep_new(hartip_tap_info);
tapinfo = wmem_new(wmem_packet_scope(), hartip_tap_info);
tapinfo->message_type = message_type;
tapinfo->message_id = message_id;
tap_queue_packet(hartip_tap, pinfo, tapinfo);

View File

@ -42,7 +42,6 @@
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/base64.h>
#include <epan/emem.h>
#include <epan/stats_tree.h>
#include <epan/req_resp_hdrs.h>
@ -156,13 +155,13 @@ header_fields_update_cb(void *r, const char **err)
char c;
if (rec->header_name == NULL) {
*err = ep_strdup_printf("Header name can't be empty");
*err = wmem_strdup_printf(wmem_packet_scope(), "Header name can't be empty");
return;
}
g_strstrip(rec->header_name);
if (rec->header_name[0] == 0) {
*err = ep_strdup_printf("Header name can't be empty");
*err = wmem_strdup_printf(wmem_packet_scope(), "Header name can't be empty");
return;
}
@ -171,7 +170,7 @@ header_fields_update_cb(void *r, const char **err)
*/
c = proto_check_field_name(rec->header_name);
if (c) {
*err = ep_strdup_printf("Header name can't contain '%c'", c);
*err = wmem_strdup_printf(wmem_packet_scope(), "Header name can't contain '%c'", c);
return;
}
@ -752,7 +751,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
}
stat_info = ep_new(http_info_value_t);
stat_info = wmem_new(wmem_packet_scope(), http_info_value_t);
stat_info->framenum = pinfo->fd->num;
stat_info->response_code = 0;
stat_info->request_method = NULL;
@ -1000,9 +999,9 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
if (tree && stat_info->http_host && stat_info->request_uri) {
proto_item *e_ti;
gchar *uri = ep_strdup_printf("%s://%s%s",
gchar *uri = wmem_strdup_printf(wmem_packet_scope(), "%s://%s%s",
"http", /* XXX, https? */
g_strstrip(ep_strdup(stat_info->http_host)), stat_info->request_uri);
g_strstrip(wmem_strdup(wmem_packet_scope(), stat_info->http_host)), stat_info->request_uri);
e_ti = proto_tree_add_string(http_tree,
hf_http_request_full_uri, tvb, 0,
@ -1348,7 +1347,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
* an active listener to process it (which happens when
* the export object window is open). */
if(have_tap_listener(http_eo_tap)) {
eo_info = ep_new(http_eo_t);
eo_info = wmem_new(wmem_packet_scope(), http_eo_t);
eo_info->hostname = conv_data->http_host;
eo_info->filename = conv_data->request_uri;
@ -1377,7 +1376,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
private_data_changed = TRUE;
if (headers.content_type_parameters)
pinfo->private_data = ep_strdup(headers.content_type_parameters);
pinfo->private_data = wmem_strdup(wmem_packet_scope(), headers.content_type_parameters);
else
pinfo->private_data = NULL;
/*
@ -1506,8 +1505,8 @@ basic_request_dissector(tvbuff_t *tvb, proto_tree *tree, int offset,
/* Save the request URI for various later uses */
request_uri = tvb_get_ephemeral_string(tvb, offset, tokenlen);
stat_info->request_uri = ep_strdup(request_uri);
conv_data->request_uri = se_strdup(request_uri);
stat_info->request_uri = wmem_strdup(wmem_packet_scope(), request_uri);
conv_data->request_uri = wmem_strdup(wmem_file_scope(), request_uri);
proto_tree_add_string(tree, hf_http_request_uri, tvb, offset, tokenlen,
request_uri);
@ -2169,8 +2168,8 @@ is_http_request_or_reply(const gchar *data, int linelen, http_type_t *type,
if (isHttpRequestOrReply && reqresp_dissector) {
*reqresp_dissector = basic_request_dissector;
stat_info->request_method = ep_strndup(data, indx+1);
conv_data->request_method = se_strndup(data, indx+1);
stat_info->request_method = wmem_strndup(wmem_packet_scope(), data, indx+1);
conv_data->request_method = wmem_strndup(wmem_file_scope(), data, indx+1);
}
@ -2325,7 +2324,7 @@ process_header(tvbuff_t *tvb, int offset, int next_offset,
len = next_offset - offset;
line_end_offset = offset + linelen;
header_len = colon_offset - offset;
header_name = se_strndup(&line[0], header_len);
header_name = wmem_strndup(wmem_file_scope(), &line[0], header_len);
hf_index = find_header_hf_value(tvb, offset, header_len);
/*
@ -2348,7 +2347,7 @@ process_header(tvbuff_t *tvb, int offset, int next_offset,
* has value_len bytes in it.
*/
value_len = line_end_offset - value_offset;
value = (char *)ep_alloc(value_len+1);
value = (char *)wmem_alloc(wmem_packet_scope(), value_len+1);
memcpy(value, &line[value_offset - offset], value_len);
value[value_len] = '\0';
@ -2420,7 +2419,7 @@ process_header(tvbuff_t *tvb, int offset, int next_offset,
break;
case HDR_CONTENT_TYPE:
eh_ptr->content_type = (gchar*) ep_memdup((guint8*)value,value_len + 1);
eh_ptr->content_type = (gchar*) wmem_memdup(wmem_packet_scope(), (guint8*)value,value_len + 1);
for (i = 0; i < value_len; i++) {
c = value[i];
@ -2493,11 +2492,11 @@ process_header(tvbuff_t *tvb, int offset, int next_offset,
break;
case HDR_CONTENT_ENCODING:
eh_ptr->content_encoding = ep_strndup(value, value_len);
eh_ptr->content_encoding = wmem_strndup(wmem_packet_scope(), value, value_len);
break;
case HDR_TRANSFER_ENCODING:
eh_ptr->transfer_encoding = ep_strndup(value, value_len);
eh_ptr->transfer_encoding = wmem_strndup(wmem_packet_scope(), value, value_len);
if (eh_ptr->have_content_length &&
g_ascii_strncasecmp(eh_ptr->transfer_encoding, "chunked", 7) == 0) {
expert_add_info(pinfo, hdr_item, &ei_http_chunked_and_length);
@ -2505,8 +2504,8 @@ process_header(tvbuff_t *tvb, int offset, int next_offset,
break;
case HDR_HOST:
stat_info->http_host = ep_strndup(value, value_len);
conv_data->http_host = se_strndup(value, value_len);
stat_info->http_host = wmem_strndup(wmem_packet_scope(), value, value_len);
conv_data->http_host = wmem_strndup(wmem_file_scope(), value, value_len);
break;
case HDR_UPGRADE: