From 9486a3d9747ad9426913dd3302e19c5884cc2bff Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Sun, 15 Sep 2013 13:46:13 +0000 Subject: More wmem conversion (leaving uat related functions aside) svn path=/trunk/; revision=52055 --- epan/dissectors/packet-iax2.c | 20 ++++++------- epan/dissectors/packet-icep.c | 3 +- epan/dissectors/packet-iec104.c | 49 +++++++++++++++---------------- epan/dissectors/packet-ieee802154.c | 8 +++--- epan/dissectors/packet-imf.c | 11 +++---- epan/dissectors/packet-infiniband.c | 18 ++++++------ epan/dissectors/packet-ipv6.c | 9 +++--- epan/dissectors/packet-ipx.c | 8 +++--- epan/dissectors/packet-isakmp.c | 27 +++++++++++------- epan/dissectors/packet-isup.c | 18 ++++++------ epan/dissectors/packet-iuup.c | 8 +++--- epan/dissectors/packet-iwarp-mpa.c | 4 +-- epan/dissectors/packet-ixveriwave.c | 3 +- epan/dissectors/packet-json.c | 32 ++++++++++----------- epan/dissectors/packet-jxta.c | 57 ++++++++++++++++++++----------------- epan/dissectors/packet-knet.c | 17 +++++------ epan/dissectors/packet-l2tp.c | 17 +++++------ epan/dissectors/packet-lapd.c | 9 +++--- epan/dissectors/packet-ldp.c | 8 +++--- epan/dissectors/packet-ldss.c | 15 +++++----- epan/dissectors/packet-lisp.c | 3 +- epan/dissectors/packet-lldp.c | 6 ++-- 22 files changed, 186 insertions(+), 164 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index 05f8168c4f..7bc3591510 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -581,7 +581,7 @@ static gchar *key_to_str( const iax_circuit_key *key ) /* why doesn't ep_address_to_str take a const pointer? cast the warnings into oblivion. */ - /* XXX - is this a case for ep_alloc? */ + /* XXX - is this a case for wmem_packet_scope()? */ g_snprintf(strp, 80, "{%s:%i,%i}", ep_address_to_str((address *)&key->addr), key->port, @@ -646,7 +646,7 @@ static guint iax_circuit_lookup(const address *address_p, if (! circuit_id_p) { iax_circuit_key *new_key; - new_key = se_new(iax_circuit_key); + new_key = wmem_new(wmem_file_scope(), iax_circuit_key); new_key->addr.type = address_p->type; new_key->addr.len = MIN(address_p->len, MAX_ADDRESS); new_key->addr.data = new_key->address_data; @@ -655,7 +655,7 @@ static guint iax_circuit_lookup(const address *address_p, new_key->port = port; new_key->callno = callno; - circuit_id_p = (guint32 *)se_new(iax_circuit_key); + circuit_id_p = (guint32 *)wmem_new(wmem_file_scope(), iax_circuit_key); *circuit_id_p = ++circuitcount; g_hash_table_insert(iax_circuit_hashtab, new_key, circuit_id_p); @@ -996,7 +996,7 @@ static iax_call_data *iax_new_call( packet_info *pinfo, circuit_id = iax_circuit_lookup(&pinfo->src, pinfo->ptype, pinfo->srcport, scallno); - call = se_new(iax_call_data); + call = wmem_new(wmem_file_scope(), iax_call_data); call -> dataformat = AST_DATAFORMAT_NULL; call -> src_codec = 0; call -> dst_codec = 0; @@ -1030,7 +1030,7 @@ typedef struct iax_packet_data { static iax_packet_data *iax_new_packet_data(iax_call_data *call, gboolean reversed) { - iax_packet_data *p = se_new(iax_packet_data); + iax_packet_data *p = wmem_new(wmem_file_scope(), iax_packet_data); p->first_time = TRUE; p->call_data = call; p->codec = 0; @@ -1246,10 +1246,10 @@ static guint32 dissect_ies(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, break; case IAX_IE_CALLED_NUMBER: - iax2_info->calledParty = ep_strdup(tvb_format_text(tvb, offset+2, ies_len)); + iax2_info->calledParty = wmem_strdup(wmem_packet_scope(), tvb_format_text(tvb, offset+2, ies_len)); break; case IAX_IE_CALLING_NUMBER: - iax2_info->callingParty = ep_strdup(tvb_format_text(tvb, offset+2, ies_len)); + iax2_info->callingParty = wmem_strdup(wmem_packet_scope(), tvb_format_text(tvb, offset+2, ies_len)); break; case IAX_IE_APPARENT_ADDR: @@ -1478,7 +1478,7 @@ static guint32 dissect_ies(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, ie_finfo->rep->representation); else { guint8 *ie_val = NULL; - ie_val = (guint8 *)ep_alloc(ITEM_LABEL_LENGTH); + ie_val = (guint8 *)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH); proto_item_fill_label(ie_finfo, ie_val); proto_item_set_text(ti, "Information Element: %s", ie_val); @@ -2000,7 +2000,7 @@ typedef struct _call_list { static call_list *call_list_append(call_list *list, guint16 scallno) { - call_list *node = ep_new0(call_list); + call_list *node = wmem_new0(wmem_packet_scope(), call_list); node->scallno = scallno; diff --git a/epan/dissectors/packet-icep.c b/epan/dissectors/packet-icep.c index 2846acffd6..009af1ccc8 100644 --- a/epan/dissectors/packet-icep.c +++ b/epan/dissectors/packet-icep.c @@ -45,6 +45,7 @@ #include #include #include +#include #include "packet-tcp.h" #if 0 @@ -243,7 +244,7 @@ static void dissect_ice_string(packet_info *pinfo, proto_tree *tree, proto_item s = tvb_get_ephemeral_string(tvb, offset, Size); proto_tree_add_string(tree, hf_icep, tvb, offset, Size, s); } else { - s = ep_strdup("(empty)"); + s = wmem_strdup(wmem_packet_scope(), "(empty)"); /* display the 0x00 Size byte when click on a empty ice_string */ proto_tree_add_string(tree, hf_icep, tvb, offset - 1, 1, s); } diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c index 54f78d3ca6..a09da43fd7 100644 --- a/epan/dissectors/packet-iec104.c +++ b/epan/dissectors/packet-iec104.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include /* IEC-104 comment: Fields are little endian. */ @@ -1048,7 +1048,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr struct asduheader asduh; proto_item *it104; proto_tree *it104tree; - emem_strbuf_t * res; + wmem_strbuf_t * res; guint8 offset = 0; /* byte offset, signal dissection */ guint8 offset_start_ioa = 0; /* position first ioa */ @@ -1062,7 +1062,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr it104 = proto_tree_add_item(tree, proto_iec104asdu, tvb, 0, -1, ENC_NA); it104tree = proto_item_add_subtree(it104, ett_asdu); - res = ep_strbuf_new_label(NULL); + res = wmem_strbuf_new_label(wmem_packet_scope()); /* Type identification */ asduh.TypeId = tvb_get_guint8(tvb, 0); @@ -1095,33 +1095,34 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr cause_str = val_to_str(asduh.TNCause & F_CAUSE, causetx_types, " "); - ep_strbuf_append_printf(res, "ASDU=%u %s %s", asduh.Addr, val_to_str(asduh.TypeId, asdu_types, ""), cause_str); + wmem_strbuf_append_printf(res, "ASDU=%u %s %s", asduh.Addr, val_to_str(asduh.TypeId, asdu_types, ""), cause_str); if (asduh.TNCause & F_NEGA) - ep_strbuf_append(res, "_NEGA"); + wmem_strbuf_append(res, "_NEGA"); if (asduh.TNCause & F_TEST) - ep_strbuf_append(res, "_TEST"); + wmem_strbuf_append(res, "_TEST"); if ((asduh.TNCause & (F_TEST | F_NEGA)) == 0) { for (Ind=strlen(cause_str); Ind< 7; Ind++) - ep_strbuf_append(res, " "); + wmem_strbuf_append(res, " "); } if (asduh.NumIx > 1) { - ep_strbuf_append_printf(res, " IOA[%d]=%d", asduh.NumIx, asduh.IOA); + wmem_strbuf_append_printf(res, " IOA[%d]=%d", asduh.NumIx, asduh.IOA); if (asduh.SQ == F_SQ) - ep_strbuf_append_printf(res, "-%d", asduh.IOA + asduh.NumIx - 1); + wmem_strbuf_append_printf(res, "-%d", asduh.IOA + asduh.NumIx - 1); else - ep_strbuf_append(res, ",..."); + wmem_strbuf_append(res, ",..."); } else { - ep_strbuf_append_printf(res, " IOA=%d", asduh.IOA); + wmem_strbuf_append_printf(res, " IOA=%d", asduh.IOA); } - col_append_str(pinfo->cinfo, COL_INFO, res->str); + col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(res)); col_set_fence(pinfo->cinfo, COL_INFO); /* 'ASDU Details': ROOT ITEM */ - proto_item_append_text(it104, ": %s '%s'", res->str, Len >= ASDU_HEAD_LEN ? val_to_str_const(asduh.TypeId, asdu_lngtypes, "") : ""); + proto_item_append_text(it104, ": %s '%s'", wmem_strbuf_get_str(res), + Len >= ASDU_HEAD_LEN ? val_to_str_const(asduh.TypeId, asdu_lngtypes, "") : ""); /* 'Signal Details': TREE */ offset = 6; /* offset position after DUI, already stored in asduh struct */ @@ -1355,14 +1356,14 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint Off; proto_item *it104, *ti; proto_tree *it104tree; - emem_strbuf_t * res; + wmem_strbuf_t * res; col_set_str(pinfo->cinfo, COL_PROTOCOL, "104apci"); it104 = proto_tree_add_item(tree, proto_iec104apci, tvb, 0, -1, ENC_NA); it104tree = proto_item_add_subtree(it104, ett_apci); - res = ep_strbuf_new_label(NULL); + res = wmem_strbuf_new_label(wmem_packet_scope()); for (Off = 0; Off <= TcpLen - 2; Off++) { Start = tvb_get_guint8(tvb, Off); @@ -1370,7 +1371,7 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (Off > 0) { proto_tree_add_item(it104tree, hf_apcidata, tvb, 0, Off, ENC_NA); - ep_strbuf_append_printf(res, " ", Off); + wmem_strbuf_append_printf(res, " ", Off); } proto_item_set_len(it104, Off + APCI_LEN); @@ -1381,7 +1382,7 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr len = tvb_get_guint8(tvb, Off + 1); if (len < APDU_MIN_LEN) { expert_add_info_format(pinfo, ti, &ei_iec104_apdu_min_len, "APDU less than %d bytes", APDU_MIN_LEN); - ep_strbuf_append_printf(res, " ", len); + wmem_strbuf_append_printf(res, " ", len); return; } @@ -1397,35 +1398,35 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr proto_tree_add_bits_item(it104tree, hf_apcitype, tvb, (Off + 2) * 8 + 6, 2, ENC_LITTLE_ENDIAN); if (len <= APDU_MAX_LEN) { - ep_strbuf_append_printf(res, "%s %s (", + wmem_strbuf_append_printf(res, "%s %s (", (pinfo->srcport == IEC104_PORT ? "->" : "<-"), val_to_str_const(type, apci_types, "")); } else { - ep_strbuf_append_printf(res, " ", len); + wmem_strbuf_append_printf(res, " ", len); } switch(type) { case I_TYPE: temp16 = tvb_get_letohs(tvb, Off + 2) >> 1; - ep_strbuf_append_printf(res, "%d,", temp16); + wmem_strbuf_append_printf(res, "%d,", temp16); proto_tree_add_uint(it104tree, hf_apcitx, tvb, Off+2, 2, temp16); case S_TYPE: temp16 = tvb_get_letohs(tvb, Off + 4) >> 1; - ep_strbuf_append_printf(res, "%d) ", temp16); + wmem_strbuf_append_printf(res, "%d) ", temp16); proto_tree_add_uint(it104tree, hf_apcirx, tvb, Off+4, 2, temp16); break; case U_TYPE: - ep_strbuf_append_printf(res, "%s) ", val_to_str_const((temp8 >> 2) & 0x3F, u_types, "")); + wmem_strbuf_append_printf(res, "%s) ", val_to_str_const((temp8 >> 2) & 0x3F, u_types, "")); proto_tree_add_item(it104tree, hf_apciutype, tvb, Off + 2, 1, ENC_LITTLE_ENDIAN); break; } col_clear(pinfo->cinfo, COL_INFO); - col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", res->str); + col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", wmem_strbuf_get_str(res)); col_set_fence(pinfo->cinfo, COL_INFO); - proto_item_append_text(it104, ": %s", res->str); + proto_item_append_text(it104, ": %s", wmem_strbuf_get_str(res)); if (type == I_TYPE) call_dissector(iec104asdu_handle, tvb_new_subset(tvb, Off + APCI_LEN, -1, len - APCI_DATA_LEN), pinfo, tree); diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index ee70e28c64..28289810f9 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -635,7 +635,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g /* Allocate frame data with hints for upper layers */ if(!pinfo->fd->flags.visited){ - ieee_hints = se_new0(ieee802154_hints_t); + ieee_hints = wmem_new0(wmem_file_scope(), ieee802154_hints_t); p_add_proto_data(pinfo->fd, proto_ieee802154, 0, ieee_hints); } else { ieee_hints = (ieee802154_hints_t *)p_get_proto_data(pinfo->fd, proto_ieee802154, 0); @@ -2243,7 +2243,7 @@ ieee802154_map_rec *ieee802154_addr_update(ieee802154_map_tab_t *au_ieee802154_m } /* create a new mapping record */ - p_map_rec = se_new(ieee802154_map_rec); + p_map_rec = wmem_new(wmem_file_scope(), ieee802154_map_rec); p_map_rec->proto = proto; p_map_rec->start_fnum = fnum; p_map_rec->end_fnum = 0; @@ -2255,7 +2255,7 @@ ieee802154_map_rec *ieee802154_addr_update(ieee802154_map_tab_t *au_ieee802154_m g_hash_table_insert(au_ieee802154_map->short_table, old_key, p_map_rec); } else { /* create new hash entry */ - g_hash_table_insert(au_ieee802154_map->short_table, se_memdup(&addr16, sizeof(addr16)), p_map_rec); + g_hash_table_insert(au_ieee802154_map->short_table, wmem_memdup(wmem_file_scope(), &addr16, sizeof(addr16)), p_map_rec); } if ( g_hash_table_lookup_extended(au_ieee802154_map->long_table, &long_addr, &old_key, NULL) ) { @@ -2263,7 +2263,7 @@ ieee802154_map_rec *ieee802154_addr_update(ieee802154_map_tab_t *au_ieee802154_m g_hash_table_insert(au_ieee802154_map->long_table, old_key, p_map_rec); } else { /* create new hash entry */ - g_hash_table_insert(au_ieee802154_map->long_table, se_memdup(&long_addr, sizeof(long_addr)), p_map_rec); + g_hash_table_insert(au_ieee802154_map->long_table, wmem_memdup(wmem_file_scope(), &long_addr, sizeof(long_addr)), p_map_rec); } return p_map_rec; diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index 2e26c3b6b8..d27eca018b 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -508,7 +509,7 @@ dissect_imf_siolabel(tvbuff_t *tvb, int offset, int length, proto_item *item, pa int end_offset; tvbuff_t *label_tvb; gchar *type = NULL; - emem_strbuf_t *label_string = ep_strbuf_new(""); + wmem_strbuf_t *label_string = wmem_strbuf_new(wmem_packet_scope(), ""); /* a semicolon separated list of attributes */ tree = proto_item_add_subtree(item, ett_imf_siolabel); @@ -555,7 +556,7 @@ dissect_imf_siolabel(tvbuff_t *tvb, int offset, int length, proto_item *item, pa } else if (tvb_strneql(tvb, item_offset, "label", 5) == 0) { gchar *label = tvb_get_ephemeral_string(tvb, value_offset + 1, value_length - 2); /* quoted */ - label_string = ep_strbuf_append(label_string, label); + wmem_strbuf_append(label_string, label); if (tvb_get_guint8(tvb, item_offset + 5) == '*') { /* continuations */ int num = (int)strtol(tvb_get_ephemeral_string(tvb, item_offset + 6, value_offset - item_offset + 6), NULL, 10); @@ -575,13 +576,13 @@ dissect_imf_siolabel(tvbuff_t *tvb, int offset, int length, proto_item *item, pa } } while (end_offset != -1); - if (type && label_string->len > 0) { + if (type && wmem_strbuf_get_len(label_string) > 0) { if (strcmp (type, ":ess") == 0) { - label_tvb = base64_to_tvb(tvb, label_string->str); + label_tvb = base64_to_tvb(tvb, wmem_strbuf_get_str(label_string)); add_new_data_source(pinfo, label_tvb, "ESS Security Label"); dissect_ess_ESSSecurityLabel_PDU(label_tvb, pinfo, tree); } else if (strcmp (type, ":x411") == 0) { - label_tvb = base64_to_tvb(tvb, label_string->str); + label_tvb = base64_to_tvb(tvb, wmem_strbuf_get_str(label_string)); add_new_data_source(pinfo, label_tvb, "X.411 Security Label"); dissect_p1_MessageSecurityLabel_PDU(label_tvb, pinfo, tree); } diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c index 1dec165661..c647ed605f 100644 --- a/epan/dissectors/packet-infiniband.c +++ b/epan/dissectors/packet-infiniband.c @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -1618,10 +1618,10 @@ dissect_infiniband_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g /* allocate space for source/destination addresses if not allocated already. we will fill them in later */ if (!src_addr) - src_addr = se_alloc(ADDR_MAX_LEN); + src_addr = wmem_alloc(wmem_file_scope(), ADDR_MAX_LEN); if (!dst_addr) - dst_addr = se_alloc(ADDR_MAX_LEN); + dst_addr = wmem_alloc(wmem_file_scope(), ADDR_MAX_LEN); pinfo->srcport = pinfo->destport = 0xffffffff; /* set the src/dest QPN to something impossible instead of the default 0, so we don't mistake it for a MAD. (QP is only 24bit, so can't be 0xffffffff)*/ @@ -2055,10 +2055,10 @@ dissect_infiniband_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* allocate space for source/destination addresses if not allocated already. we will fill them in later */ if (!src_addr) - src_addr = se_alloc(ADDR_MAX_LEN); + src_addr = wmem_alloc(wmem_file_scope(), ADDR_MAX_LEN); if (!dst_addr) - dst_addr = se_alloc(ADDR_MAX_LEN); + dst_addr = wmem_alloc(wmem_file_scope(), ADDR_MAX_LEN); operand = tvb_get_guint8(tvb, offset); operand = (operand & 0xF0) >> 4; @@ -2973,8 +2973,8 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * proto_tree *CM_header_tree; tvbuff_t *next_tvb; - local_gid = (guint8 *)ep_alloc(GID_SIZE); - remote_gid = (guint8 *)ep_alloc(GID_SIZE); + local_gid = (guint8 *)wmem_alloc(wmem_packet_scope(), GID_SIZE); + remote_gid = (guint8 *)wmem_alloc(wmem_packet_scope(), GID_SIZE); if (!parse_MAD_Common(parentTree, tvb, offset, &MadData)) { @@ -3086,7 +3086,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * /* Now we create a conversation for the CM exchange. This uses both sides of the conversation since CM packets also include the source QPN */ - proto_data = se_new(conversation_infiniband_data); + proto_data = wmem_new(wmem_file_scope(), conversation_infiniband_data); proto_data->service_id = connection->service_id; conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, @@ -3147,7 +3147,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * connection->resp_qp = remote_qpn; - proto_data = se_new(conversation_infiniband_data); + proto_data = wmem_new(wmem_file_scope(), conversation_infiniband_data); proto_data->service_id = connection->service_id; /* RC traffic never(?) includes a field indicating the source QPN, so diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 9a492d9b01..7ab61a22ab 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include "packet-ipsec.h" #include "packet-ipv6.h" @@ -1394,7 +1394,8 @@ dissect_shim6_ct(proto_tree * shim_tree, gint hf_item, tvbuff_t * tvb, gint offs tmp[4] = tvb_get_guint8(tvb, offset++); tmp[5] = tvb_get_guint8(tvb, offset++); - ct_str = ep_strdup_printf("%s: %02X %02X %02X %02X %02X %02X", label, + ct_str = wmem_strdup_printf(wmem_packet_scope(), + "%s: %02X %02X %02X %02X %02X %02X", label, tmp[0] & SHIM6_BITMASK_CT, tmp[1], tmp[2], tmp[3], tmp[4], tmp[5] ); @@ -1839,7 +1840,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (tvb_get_guint8(tvb, offset + IP6H_SRC + 8) & 0x02 && tvb_get_ntohs(tvb, offset + IP6H_SRC + 11) == 0xfffe) { /* RFC 4291 appendix A */ - mac_addr = (guint8 *)ep_alloc(6); + mac_addr = (guint8 *)wmem_alloc(wmem_packet_scope(), 6); tvb_memcpy(tvb, mac_addr, offset + IP6H_SRC + 8, 3); tvb_memcpy(tvb, mac_addr+3, offset+ IP6H_SRC + 13, 3); mac_addr[0] &= ~0x02; @@ -1926,7 +1927,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (tvb_get_guint8(tvb, offset + IP6H_DST + 8) & 0x02 && tvb_get_ntohs(tvb, offset + IP6H_DST + 11) == 0xfffe) { /* RFC 4291 appendix A */ - mac_addr = (guint8 *)ep_alloc(6); + mac_addr = (guint8 *)wmem_alloc(wmem_packet_scope(), 6); tvb_memcpy(tvb, mac_addr, offset + IP6H_DST + 8, 3); tvb_memcpy(tvb, mac_addr+3, offset+ IP6H_DST + 13, 3); mac_addr[0] &= ~0x02; diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c index 3d0dd9a4f4..b873a3ac8d 100644 --- a/epan/dissectors/packet-ipx.c +++ b/epan/dissectors/packet-ipx.c @@ -41,7 +41,7 @@ #include #include #include -#include +#include static int ipx_tap = -1; @@ -487,12 +487,12 @@ spx_hash_insert(conversation_t *conversation, guint32 spx_src, guint16 spx_seq) spx_hash_value *value; /* Now remember the packet, so we can find it if we later. */ - key = se_new(spx_hash_key); + key = wmem_new(wmem_file_scope(), spx_hash_key); key->conversation = conversation; key->spx_src = spx_src; key->spx_seq = spx_seq; - value = se_new0(spx_hash_value); + value = wmem_new0(wmem_file_scope(), spx_hash_value); g_hash_table_insert(spx_hash, key, value); @@ -725,7 +725,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Found in the hash table. Mark this frame as * a retransmission. */ - spx_rexmit_info_p = se_new(spx_rexmit_info); + spx_rexmit_info_p = wmem_new(wmem_file_scope(), spx_rexmit_info); spx_rexmit_info_p->num = pkt_value->num; p_add_proto_data(pinfo->fd, proto_spx, 0, spx_rexmit_info_p); diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index a4d496508a..3e4a64af58 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -48,7 +48,7 @@ #include #include - +#include #include #include #include @@ -2576,7 +2576,7 @@ byte_to_str(const guint8 *val,const gint val_len, const byte_string *vs, const c if (ret != NULL) return ret; - return ep_strdup_printf(fmt, val); + return wmem_strdup_printf(wmem_packet_scope(), fmt, val); } @@ -2804,7 +2804,7 @@ dissect_isakmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (ike_sa_data) { guint8 initiator_flag; initiator_flag = hdr.flags & I_FLAG; - ikev2_dec_data = ep_new(ikev2_decrypt_data_t); + ikev2_dec_data = wmem_new(wmem_packet_scope(), ikev2_decrypt_data_t); ikev2_dec_data->encr_key = initiator_flag ? ike_sa_data->sk_ei : ike_sa_data->sk_er; ikev2_dec_data->auth_key = initiator_flag ? ike_sa_data->sk_ai : ike_sa_data->sk_ar; ikev2_dec_data->encr_spec = ike_sa_data->encr_spec; @@ -4677,12 +4677,14 @@ dissect_enc(tvbuff_t *tvb, if (key_info->auth_spec->gcry_alg) { err = gcry_md_open(&md_hd, key_info->auth_spec->gcry_alg, key_info->auth_spec->gcry_flag); if (err) { - REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 hashing error: algorithm %d: gcry_md_open failed: %s", + REPORT_DISSECTOR_BUG(wmem_strdup_printf(wmem_packet_scope(), + "IKEv2 hashing error: algorithm %d: gcry_md_open failed: %s", key_info->auth_spec->gcry_alg, gcry_strerror(err))); } err = gcry_md_setkey(md_hd, key_info->auth_key, key_info->auth_spec->key_len); if (err) { - REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 hashing error: algorithm %s, key length %u: gcry_md_setkey failed: %s", + REPORT_DISSECTOR_BUG(wmem_strdup_printf(wmem_packet_scope(), + "IKEv2 hashing error: algorithm %s, key length %u: gcry_md_setkey failed: %s", gcry_md_algo_name(key_info->auth_spec->gcry_alg), key_info->auth_spec->key_len, gcry_strerror(err))); } @@ -4693,7 +4695,8 @@ dissect_enc(tvbuff_t *tvb, md_len = gcry_md_get_algo_dlen(key_info->auth_spec->gcry_alg); if (md_len < icd_len) { gcry_md_close(md_hd); - REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 hashing error: algorithm %s: gcry_md_get_algo_dlen returned %d which is smaller than icd length %d", + REPORT_DISSECTOR_BUG(wmem_strdup_printf(wmem_packet_scope(), + "IKEv2 hashing error: algorithm %s: gcry_md_get_algo_dlen returned %d which is smaller than icd length %d", gcry_md_algo_name(key_info->auth_spec->gcry_alg), md_len, icd_len)); } if (tvb_memeql(tvb, offset, md, icd_len) == 0) { @@ -4734,25 +4737,29 @@ dissect_enc(tvbuff_t *tvb, err = gcry_cipher_open(&cipher_hd, key_info->encr_spec->gcry_alg, key_info->encr_spec->gcry_mode, 0); if (err) { g_free(decr_data); - REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d, mode %d: gcry_cipher_open failed: %s", + REPORT_DISSECTOR_BUG(wmem_strdup_printf(wmem_packet_scope(), + "IKEv2 decryption error: algorithm %d, mode %d: gcry_cipher_open failed: %s", key_info->encr_spec->gcry_alg, key_info->encr_spec->gcry_mode, gcry_strerror(err))); } err = gcry_cipher_setkey(cipher_hd, key_info->encr_key, key_info->encr_spec->key_len); if (err) { g_free(decr_data); - REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d, key length %d: gcry_cipher_setkey failed: %s", + REPORT_DISSECTOR_BUG(wmem_strdup_printf(wmem_packet_scope(), + "IKEv2 decryption error: algorithm %d, key length %d: gcry_cipher_setkey failed: %s", key_info->encr_spec->gcry_alg, key_info->encr_spec->key_len, gcry_strerror(err))); } err = gcry_cipher_setiv(cipher_hd, iv, iv_len); if (err) { g_free(decr_data); - REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d, iv length %d: gcry_cipher_setiv failed: %s", + REPORT_DISSECTOR_BUG(wmem_strdup_printf(wmem_packet_scope(), + "IKEv2 decryption error: algorithm %d, iv length %d: gcry_cipher_setiv failed: %s", key_info->encr_spec->gcry_alg, iv_len, gcry_strerror(err))); } err = gcry_cipher_decrypt(cipher_hd, decr_data, decr_data_len, encr_data, encr_data_len); if (err) { g_free(decr_data); - REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d: gcry_cipher_decrypt failed: %s", + REPORT_DISSECTOR_BUG(wmem_strdup_printf(wmem_packet_scope(), + "IKEv2 decryption error: algorithm %d: gcry_cipher_decrypt failed: %s", key_info->encr_spec->gcry_alg, gcry_strerror(err))); } gcry_cipher_close(cipher_hd); diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index dca129d9c8..d8598cbc86 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -57,7 +57,7 @@ #include "packet-e164.h" #include "packet-charging_ase.h" #include -#include +#include #include #include #include @@ -3310,7 +3310,7 @@ dissect_isup_called_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree * proto_tree_add_string(address_digits_tree, hf_isup_called, parameter_tvb, offset - length, length, called_number); } - tap_called_number = ep_strdup(called_number); + tap_called_number = wmem_strdup(wmem_packet_scope(), called_number); } /* ------------------------------------------------------------------ Dissector Parameter Subsequent number @@ -5172,7 +5172,7 @@ dissect_isup_calling_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree } proto_item_set_text(parameter_item, "Calling Party Number: %s", calling_number); - tap_calling_number = ep_strdup(calling_number); + tap_calling_number = wmem_strdup(wmem_packet_scope(), calling_number); } /* ------------------------------------------------------------------ Dissector Parameter Original called number @@ -6930,7 +6930,7 @@ dissect_isup_generic_name_parameter(tvbuff_t *parameter_tvb, proto_tree *paramet gint gen_name_length; char *gen_name = NULL; - gen_name = (char *)ep_alloc(MAXGNAME + 1); + gen_name = (char *)wmem_alloc(wmem_packet_scope(), MAXGNAME + 1); gen_name[0] = '\0'; gen_name_length = tvb_length(parameter_tvb) - 1; indicator = tvb_get_guint8(parameter_tvb, 0); @@ -9945,7 +9945,7 @@ dissect_ansi_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree offset += MESSAGE_TYPE_LENGTH; - tap_rec = (isup_tap_rec_t *)ep_alloc(sizeof(isup_tap_rec_t)); + tap_rec = (isup_tap_rec_t *)wmem_alloc(wmem_packet_scope(), sizeof(isup_tap_rec_t)); tap_rec->message_type = message_type; tap_rec->calling_number = NULL; tap_rec->called_number = NULL; @@ -10185,7 +10185,7 @@ dissect_ansi_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree proto_tree_add_text(isup_tree, message_tvb, 0, 0, "No optional parameters are possible with this message type"); /* if there are calling/called number, we'll get them for the tap */ - tap_rec->calling_number = tap_calling_number ? tap_calling_number : ep_strdup(""); + tap_rec->calling_number = tap_calling_number ? tap_calling_number : wmem_strdup(wmem_packet_scope(), ""); tap_rec->called_number = tap_called_number; tap_rec->cause_value = tap_cause_value; tap_queue_packet(isup_tap, pinfo, tap_rec); @@ -10245,7 +10245,7 @@ dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup offset += MESSAGE_TYPE_LENGTH; - tap_rec = (isup_tap_rec_t *)ep_alloc(sizeof(isup_tap_rec_t)); + tap_rec = (isup_tap_rec_t *)wmem_alloc(wmem_packet_scope(), sizeof(isup_tap_rec_t)); tap_rec->message_type = message_type; tap_rec->calling_number = NULL; tap_rec->called_number = NULL; @@ -10553,7 +10553,7 @@ dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup proto_tree_add_text(isup_tree, message_tvb, 0, 0, "No optional parameters are possible with this message type"); /* if there are calling/called number, we'll get them for the tap */ - tap_rec->calling_number = tap_calling_number ? tap_calling_number : ep_strdup(""); + tap_rec->calling_number = tap_calling_number ? tap_calling_number : wmem_strdup(wmem_packet_scope(), ""); tap_rec->called_number = tap_called_number; tap_rec->cause_value = tap_cause_value; tap_queue_packet(isup_tap, pinfo, tap_rec); @@ -10838,7 +10838,7 @@ msg_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U int msg_node; int dir_node; - dir = ep_strdup_printf("%s->%s", ep_address_to_str(&pinfo->src), ep_address_to_str(&pinfo->dst)); + dir = wmem_strdup_printf(wmem_packet_scope(), "%s->%s", ep_address_to_str(&pinfo->src), ep_address_to_str(&pinfo->dst)); msg_node = tick_stat_node(st, msg, st_node_msg, TRUE); tick_stat_node(st, dir, msg_node, FALSE); diff --git a/epan/dissectors/packet-iuup.c b/epan/dissectors/packet-iuup.c index 650cf22c2c..59d6ea9296 100644 --- a/epan/dissectors/packet-iuup.c +++ b/epan/dissectors/packet-iuup.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -418,7 +418,7 @@ static guint dissect_rfcis(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tr guint i; do { - iuup_rfci_t *rfci = se_new0(iuup_rfci_t); + iuup_rfci_t *rfci = wmem_new0(wmem_file_scope(), iuup_rfci_t); guint len = 0; DISSECTOR_ASSERT(c < 64); @@ -489,9 +489,9 @@ static void dissect_iuup_init(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tre g_hash_table_remove(circuits,GUINT_TO_POINTER(pinfo->circuit_id)); } - iuup_circuit = se_new0(iuup_circuit_t); + iuup_circuit = wmem_new0(wmem_file_scope(), iuup_circuit_t); } else { - iuup_circuit = ep_new0(iuup_circuit_t); + iuup_circuit = wmem_new0(wmem_packet_scope(), iuup_circuit_t); } iuup_circuit->id = pinfo->circuit_id; diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index 7a3e01a449..dd22971f21 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -30,7 +30,7 @@ #include "config.h" #include -#include +#include #include #include #include @@ -208,7 +208,7 @@ init_mpa_state(void) { mpa_state_t *state; - state = (mpa_state_t *) se_alloc0(sizeof(mpa_state_t)); + state = (mpa_state_t *) wmem_alloc0(wmem_file_scope(), sizeof(mpa_state_t)); state->revision = -1; return state; } diff --git a/epan/dissectors/packet-ixveriwave.c b/epan/dissectors/packet-ixveriwave.c index 9d05123f74..d5acdfc3bc 100644 --- a/epan/dissectors/packet-ixveriwave.c +++ b/epan/dissectors/packet-ixveriwave.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "packet-eth.h" @@ -483,7 +484,7 @@ dissect_ixveriwave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!p_ifg_info) { /* allocate the space */ - p_ifg_info = se_new0(struct ifg_info); + p_ifg_info = wmem_new0(wmem_file_scope(), struct ifg_info); /* Doesn't exist, so we need to calculate the value */ if (previous_frame_data.previous_frame_num !=0 && (pinfo->fd->num - previous_frame_data.previous_frame_num == 1)) diff --git a/epan/dissectors/packet-json.c b/epan/dissectors/packet-json.c index a31d9c30be..23a95048da 100644 --- a/epan/dissectors/packet-json.c +++ b/epan/dissectors/packet-json.c @@ -33,7 +33,7 @@ #include -#include +#include #include #include @@ -97,7 +97,7 @@ typedef enum { } json_token_type_t; typedef struct { - ep_stack_t stack; + wmem_stack_t *stack; } json_parser_data_t; @@ -136,9 +136,9 @@ dissect_json(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset = 0; - - parser_data.stack = ep_stack_new(); - ep_stack_push(parser_data.stack, json_tree); + + parser_data.stack = wmem_stack_new(wmem_packet_scope()); + wmem_stack_push(parser_data.stack, json_tree); tt = tvbparse_init(tvb, offset, -1, &parser_data, want_ignore); @@ -169,39 +169,39 @@ dissect_json(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void before_object(void *tvbparse_data, const void *wanted_data _U_, tvbparse_elem_t *tok) { json_parser_data_t *data = (json_parser_data_t *) tvbparse_data; - proto_tree *tree = (proto_tree *)ep_stack_peek(data->stack); + proto_tree *tree = (proto_tree *)wmem_stack_peek(data->stack); proto_tree *subtree; proto_item *ti; ti = proto_tree_add_item(tree, &hfi_json_object, tok->tvb, tok->offset, tok->len, ENC_NA); subtree = proto_item_add_subtree(ti, ett_json_object); - ep_stack_push(data->stack, subtree); + wmem_stack_push(data->stack, subtree); } static void after_object(void *tvbparse_data, const void *wanted_data _U_, tvbparse_elem_t *elem _U_) { json_parser_data_t *data = (json_parser_data_t *) tvbparse_data; - ep_stack_pop(data->stack); + wmem_stack_pop(data->stack); } static void before_member(void *tvbparse_data, const void *wanted_data _U_, tvbparse_elem_t *tok) { json_parser_data_t *data = (json_parser_data_t *) tvbparse_data; - proto_tree *tree = (proto_tree *)ep_stack_peek(data->stack); + proto_tree *tree = (proto_tree *)wmem_stack_peek(data->stack); proto_tree *subtree; proto_item *ti; ti = proto_tree_add_item(tree, &hfi_json_member, tok->tvb, tok->offset, tok->len, ENC_NA); subtree = proto_item_add_subtree(ti, ett_json_member); - ep_stack_push(data->stack, subtree); + wmem_stack_push(data->stack, subtree); } static void after_member(void *tvbparse_data, const void *wanted_data _U_, tvbparse_elem_t *tok) { json_parser_data_t *data = (json_parser_data_t *) tvbparse_data; - proto_tree *tree = (proto_tree *)ep_stack_pop(data->stack); + proto_tree *tree = (proto_tree *)wmem_stack_pop(data->stack); if (tree) { tvbparse_elem_t *key_tok = tok->sub; @@ -218,20 +218,20 @@ static void after_member(void *tvbparse_data, const void *wanted_data _U_, tvbpa static void before_array(void *tvbparse_data, const void *wanted_data _U_, tvbparse_elem_t *tok) { json_parser_data_t *data = (json_parser_data_t *) tvbparse_data; - proto_tree *tree = (proto_tree *)ep_stack_peek(data->stack); + proto_tree *tree = (proto_tree *)wmem_stack_peek(data->stack); proto_tree *subtree; proto_item *ti; ti = proto_tree_add_item(tree, &hfi_json_array, tok->tvb, tok->offset, tok->len, ENC_NA); subtree = proto_item_add_subtree(ti, ett_json_array); - ep_stack_push(data->stack, subtree); + wmem_stack_push(data->stack, subtree); } static void after_array(void *tvbparse_data, const void *wanted_data _U_, tvbparse_elem_t *elem _U_) { json_parser_data_t *data = (json_parser_data_t *) tvbparse_data; - ep_stack_pop(data->stack); + wmem_stack_pop(data->stack); } /* @@ -250,7 +250,7 @@ static void after_array(void *tvbparse_data, const void *wanted_data _U_, tvbpar static char *json_string_unescape(tvbparse_elem_t *tok) { - char *str = (char *)ep_alloc(tok->len - 1); + char *str = (char *)wmem_alloc(wmem_packet_scope(), tok->len - 1); int i, j; j = 0; @@ -374,7 +374,7 @@ static char *json_string_unescape(tvbparse_elem_t *tok) static void after_value(void *tvbparse_data, const void *wanted_data _U_, tvbparse_elem_t *tok) { json_parser_data_t *data = (json_parser_data_t *) tvbparse_data; - proto_tree *tree = (proto_tree *)ep_stack_peek(data->stack); + proto_tree *tree = (proto_tree *)wmem_stack_peek(data->stack); json_token_type_t value_id = JSON_TOKEN_INVALID; if (tok->sub) diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 8f5878718d..38c0a6b85f 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include "packet-jxta.h" @@ -693,7 +693,7 @@ static jxta_stream_conversation_data *get_tpt_conversation(packet_info * pinfo) tpt_conv_data = (jxta_stream_conversation_data *) conversation_get_proto_data(tpt_conversation, proto_jxta); if (NULL == tpt_conv_data) { - tpt_conv_data = se_new(jxta_stream_conversation_data); + tpt_conv_data = wmem_new(wmem_file_scope(), jxta_stream_conversation_data); tpt_conv_data->tpt_ptype = pinfo->ptype; SE_COPY_ADDRESS(&tpt_conv_data->initiator_tpt_address, &pinfo->src); @@ -863,7 +863,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree if (NULL != found_addr) { found_addr->type = AT_URI; found_addr->len = (int) strlen(*current_token); - found_addr->data = se_strdup(*current_token); + found_addr->data = wmem_strdup(wmem_file_scope(), *current_token); } token_offset += (guint) strlen(*current_token) + 1; @@ -1129,8 +1129,8 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree guint tree_offset = 0; guint available; gint needed = 0; - emem_strbuf_t* src_addr; - emem_strbuf_t* dst_addr; + wmem_strbuf_t* src_addr; + wmem_strbuf_t* dst_addr; while (TRUE) { guint8 message_version; @@ -1255,7 +1255,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree } if ((AT_URI == pinfo->src.type) && (AT_URI == pinfo->dst.type)) { - jxta_tap_header *tap_header = se_new(jxta_tap_header); + jxta_tap_header *tap_header = wmem_new(wmem_file_scope(), jxta_tap_header); tap_header->src_address = pinfo->src; tap_header->dest_address = pinfo->dst; @@ -1276,21 +1276,25 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree return -needed; } - src_addr = ep_strbuf_new_label(ep_address_to_str(&pinfo->src)); - dst_addr = ep_strbuf_new_label(ep_address_to_str(&pinfo->dst)); + src_addr = wmem_strbuf_new_label(wmem_packet_scope()); + wmem_strbuf_append(src_addr, ep_address_to_str(&pinfo->src)); + dst_addr = wmem_strbuf_new_label(wmem_packet_scope()); + wmem_strbuf_append(dst_addr, ep_address_to_str(&pinfo->dst)); /* append the port if appropriate */ if (PT_NONE != pinfo->ptype) { - ep_strbuf_append_printf(src_addr, ":%d", pinfo->srcport); - ep_strbuf_append_printf(dst_addr, ":%d", pinfo->destport); + wmem_strbuf_append_printf(src_addr, ":%d", pinfo->srcport); + wmem_strbuf_append_printf(dst_addr, ":%d", pinfo->destport); } col_set_str(pinfo->cinfo, COL_PROTOCOL, "JXTA"); if( complete_messages > 1 ) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%d Messages, %s -> %s", complete_messages, src_addr->str, dst_addr->str); + col_add_fstr(pinfo->cinfo, COL_INFO, "%d Messages, %s -> %s", complete_messages, + wmem_strbuf_get_str(src_addr), wmem_strbuf_get_str(dst_addr)); } else { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message, %s -> %s", src_addr->str, dst_addr->str); + col_add_fstr(pinfo->cinfo, COL_INFO, "Message, %s -> %s", + wmem_strbuf_get_str(src_addr), wmem_strbuf_get_str(dst_addr)); } col_set_writable(pinfo->cinfo, FALSE); @@ -1307,41 +1311,42 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree proto_item *tree_item; jxta_msg_tree_item = proto_tree_add_protocol_format(tree, proto_message_jxta, tvb, tree_offset, -1, - "JXTA Message, %s -> %s", src_addr->str, dst_addr->str); + "JXTA Message, %s -> %s", wmem_strbuf_get_str(src_addr), + wmem_strbuf_get_str(dst_addr)); jxta_msg_tree = proto_item_add_subtree(jxta_msg_tree_item, ett_jxta_msg); proto_tree_add_item(jxta_msg_tree, hf_jxta_message_sig, tvb, tree_offset, (int)sizeof(JXTA_MSG_SIG), ENC_ASCII|ENC_NA); tree_offset += (int)sizeof(JXTA_MSG_SIG); - tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_src, tvb, 0, 0, src_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_src, tvb, 0, 0, wmem_strbuf_get_str(src_addr)); PROTO_ITEM_SET_GENERATED(tree_item); - tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_address, tvb, 0, 0, src_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_address, tvb, 0, 0, wmem_strbuf_get_str(src_addr)); PROTO_ITEM_SET_HIDDEN(tree_item); PROTO_ITEM_SET_GENERATED(tree_item); if(AT_URI == pinfo->src.type) { - tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_src, tvb, 0, 0, src_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_src, tvb, 0, 0, wmem_strbuf_get_str(src_addr)); PROTO_ITEM_SET_HIDDEN(tree_item); PROTO_ITEM_SET_GENERATED(tree_item); - tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_addr, tvb, 0, 0, src_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_addr, tvb, 0, 0, wmem_strbuf_get_str(src_addr)); PROTO_ITEM_SET_HIDDEN(tree_item); PROTO_ITEM_SET_GENERATED(tree_item); } - tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_dst, tvb, 0, 0, dst_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_dst, tvb, 0, 0, wmem_strbuf_get_str(dst_addr)); PROTO_ITEM_SET_GENERATED(tree_item); - tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_address, tvb, 0, 0, dst_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_address, tvb, 0, 0, wmem_strbuf_get_str(dst_addr)); PROTO_ITEM_SET_HIDDEN(tree_item); PROTO_ITEM_SET_GENERATED(tree_item); if(AT_URI == pinfo->dst.type) { - tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_dst, tvb, 0, 0, src_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_dst, tvb, 0, 0, wmem_strbuf_get_str(src_addr)); PROTO_ITEM_SET_HIDDEN(tree_item); PROTO_ITEM_SET_GENERATED(tree_item); - tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_addr, tvb, 0, 0, dst_addr->str); + tree_item = proto_tree_add_string(jxta_msg_tree, hf_uri_addr, tvb, 0, 0, wmem_strbuf_get_str(dst_addr)); PROTO_ITEM_SET_HIDDEN(tree_item); PROTO_ITEM_SET_GENERATED(tree_item); } @@ -1363,7 +1368,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_names_count, tvb, tree_offset, (int)sizeof(guint16), msg_names_count); tree_offset += (int)sizeof(guint16); - names_table = (const gchar **)ep_alloc((msg_names_count + 2) * sizeof(const gchar *)); + names_table = (const gchar **)wmem_alloc(wmem_packet_scope(), (msg_names_count + 2) * sizeof(const gchar *)); names_table[0] = ""; names_table[1] = "jxta"; @@ -1900,7 +1905,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p if (mimeID < names_count) { proto_item_append_text(mime_ti, " (%s)", names_table[mimeID]); - mediatype = ep_strdup( names_table[mimeID] ); + mediatype = wmem_strdup( wmem_packet_scope(), names_table[mimeID] ); } else { proto_item_append_text(mime_ti, " * BAD *"); } @@ -1979,21 +1984,21 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf int dissected = 0; if (fullmediatype) { - gchar *mediatype = ep_strdup(fullmediatype); + gchar *mediatype = wmem_strdup(wmem_packet_scope(), fullmediatype); gchar *parms_at = strchr(mediatype, ';'); const char *save_match_string = pinfo->match_string; void * save_private_data = pinfo->private_data; /* Based upon what is done in packet-media.c we set up type and params */ if (NULL != parms_at) { - pinfo->private_data = ep_strdup( parms_at + 1 ); + pinfo->private_data = wmem_strdup( wmem_packet_scope(), parms_at + 1 ); *parms_at = '\0'; } else { pinfo->private_data = NULL; } /* Set the version that goes to packet-media.c before converting case */ - pinfo->match_string = ep_strdup(mediatype); + pinfo->match_string = wmem_strdup(wmem_packet_scope(), mediatype); /* force to lower case */ ascii_strdown_inplace(mediatype); diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c index ab884e310d..a7d2977f46 100644 --- a/epan/dissectors/packet-knet.c +++ b/epan/dissectors/packet-knet.c @@ -28,6 +28,7 @@ #include #include +#include #include #define PROTO_TAG_KNET "KNET" /*!< Definition of kNet Protocol */ @@ -363,7 +364,7 @@ dissect_reliable_message_number(tvbuff_t *buffer, int offset, proto_tree *tree) * */ static int -dissect_messageid(tvbuff_t *buffer, int *offset, proto_tree *tree, packet_info *pinfo, emem_strbuf_t* info_field) +dissect_messageid(tvbuff_t *buffer, int *offset, proto_tree *tree, packet_info *pinfo, wmem_strbuf_t* info_field) { gint messageid_length; guint8 messageid; @@ -391,7 +392,7 @@ dissect_messageid(tvbuff_t *buffer, int *offset, proto_tree *tree, packet_info * *offset += messageid_length; - ep_strbuf_append_printf(info_field, "Msg ID (%d) ", messageid); + wmem_strbuf_append_printf(info_field, "Msg ID (%d) ", messageid); return messageid; } @@ -466,7 +467,7 @@ dissect_payload(tvbuff_t *buffer, int offset, int messageid, proto_tree *tree, i * */ static void -dissect_knet_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, emem_strbuf_t* info_field) +dissect_knet_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, wmem_strbuf_t* info_field) { int offset; int content_length; @@ -488,7 +489,7 @@ dissect_knet_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, em content_length = dissect_content_length(tvb, offset, msgblock_tree); /* Calculates the Content Length of this packet. */ - ep_strbuf_append_printf(info_field, "%d: ", messageindex + 1); + wmem_strbuf_append_printf(info_field, "%d: ", messageindex + 1); offset += 2; /* Move the offset the amount of contentlength and flags fields */ @@ -537,7 +538,7 @@ dissect_knet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gboolean bytes_left; /* String that is going to be displayed in the info column in Wireshark */ - emem_strbuf_t *info_field = ep_strbuf_new(""); + wmem_strbuf_t *info_field = wmem_strbuf_new(wmem_packet_scope(), ""); int offset; int length; @@ -575,7 +576,7 @@ dissect_knet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tree == NULL) offset += count_vle_bytes(next_tvb, offset); - ep_strbuf_append_printf(info_field, "%d: ", messageindex + 1); + wmem_strbuf_append_printf(info_field, "%d: ", messageindex + 1); messageid = dissect_messageid(next_tvb, &offset, message_tree, pinfo, info_field); /* Calculate messageid and add it to the tree-view */ @@ -603,7 +604,7 @@ dissect_knet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) packetid = dissect_packetid(tvb, 0, datagram_tree); /* Lets calculate our packetid! */ - ep_strbuf_append_printf(info_field, "Packet ID: %d ", packetid); + wmem_strbuf_append_printf(info_field, "Packet ID: %d ", packetid); offset += 3; @@ -644,7 +645,7 @@ dissect_knet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(current_protocol == KNET_TCP_PACKET && ((struct tcpinfo*)(pinfo->private_data))->is_reassembled) col_add_str(pinfo->cinfo, COL_INFO, "REASSEMBLED PACKET"); else - col_add_fstr(pinfo->cinfo, COL_INFO, "Messages: %d %s", messageindex + 1, info_field->str); + col_add_fstr(pinfo->cinfo, COL_INFO, "Messages: %d %s", messageindex + 1, wmem_strbuf_get_str(info_field)); messageindex++; } diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index 495c3ca48a..cabeb51f4a 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -69,6 +69,7 @@ #include #include #include +#include static int proto_l2tp = -1; static int hf_l2tp_type = -1; @@ -835,7 +836,7 @@ static void update_shared_key(l2tpv3_tunnel_t *tunnel) /* For secret specification, see RFC 3931 pg 37 */ guint8 data = 2; md5_hmac(&data, 1, secret, strlen(secret), tunnel->shared_key); - tunnel->shared_key_secret = se_strdup(secret); + tunnel->shared_key_secret = wmem_strdup(wmem_file_scope(), secret); } } @@ -970,14 +971,14 @@ static void store_cma_nonce(l2tpv3_tunnel_t *tunnel, switch (msg_type) { case MESSAGE_TYPE_SCCRQ: if (!tunnel->lcce1_nonce) { - tunnel->lcce1_nonce = (guint8 *)se_alloc(length); + tunnel->lcce1_nonce = (guint8 *)wmem_alloc(wmem_file_scope(), length); tunnel->lcce1_nonce_len = length; nonce = tunnel->lcce1_nonce; } break; case MESSAGE_TYPE_SCCRP: if (!tunnel->lcce2_nonce) { - tunnel->lcce2_nonce = (guint8 *)se_alloc(length); + tunnel->lcce2_nonce = (guint8 *)wmem_alloc(wmem_file_scope(), length); tunnel->lcce2_nonce_len = length; nonce = tunnel->lcce2_nonce; } @@ -1045,7 +1046,7 @@ static void init_session(l2tpv3_session_t *session) static l2tpv3_session_t *alloc_session(void) { - l2tpv3_session_t *session = ep_new0(l2tpv3_session_t); + l2tpv3_session_t *session = wmem_new0(wmem_packet_scope(), l2tpv3_session_t); init_session(session); return session; @@ -1247,7 +1248,7 @@ static void update_session(l2tpv3_tunnel_t *tunnel, l2tpv3_session_t *session) existing = find_session(tunnel, session->lcce1.id, session->lcce2.id); if (!existing) { - existing = se_new0(l2tpv3_session_t); + existing = wmem_new0(wmem_file_scope(), l2tpv3_session_t); init_session(existing); } @@ -2428,7 +2429,7 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int process_control_avps(tvb, pinfo, l2tp_tree, idx, length+baseIdx, tunnel); if (tunnel == &tmp_tunnel && l2tp_conv->tunnel == NULL) { - l2tp_conv->tunnel = se_new0(l2tpv3_tunnel_t); + l2tp_conv->tunnel = wmem_new0(wmem_file_scope(), l2tpv3_tunnel_t); memcpy(l2tp_conv->tunnel, &tmp_tunnel, sizeof(l2tpv3_tunnel_t)); } } @@ -2500,7 +2501,7 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data case 3: l2tp_conv = (l2tpv3_conversation_t *)conversation_get_proto_data(conv, proto_l2tp); if (!l2tp_conv) { - l2tp_conv = se_new0(l2tpv3_conversation_t); + l2tp_conv = wmem_new0(wmem_file_scope(), l2tpv3_conversation_t); l2tp_conv->pt = PT_UDP; conversation_add_proto_data(conv, proto_l2tp, (void *)l2tp_conv); } @@ -2686,7 +2687,7 @@ dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) l2tp_conv = (l2tpv3_conversation_t *)conversation_get_proto_data(conv, proto_l2tp); if (!l2tp_conv) { - l2tp_conv = se_new0(l2tpv3_conversation_t); + l2tp_conv = wmem_new0(wmem_file_scope(), l2tpv3_conversation_t); l2tp_conv->pt = PT_NONE; conversation_add_proto_data(conv, proto_l2tp, (void *)l2tp_conv); } diff --git a/epan/dissectors/packet-lapd.c b/epan/dissectors/packet-lapd.c index f15f4cd908..b9ba012a09 100644 --- a/epan/dissectors/packet-lapd.c +++ b/epan/dissectors/packet-lapd.c @@ -48,6 +48,7 @@ #include #include #include +#include static int proto_lapd = -1; static int hf_lapd_direction = -1; @@ -363,7 +364,7 @@ dissect_lapd_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { if (NULL == p_get_proto_data(pinfo->fd, proto_lapd, 0)) { /* Per packet information */ - lapd_ppi = se_new(lapd_ppi_t); + lapd_ppi = wmem_new(wmem_file_scope(), lapd_ppi_t); lapd_ppi->has_crc = TRUE; if (prev_byte_state) fill_lapd_byte_state(&lapd_ppi->start_byte_state, prev_byte_state->state, @@ -383,13 +384,13 @@ dissect_lapd_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fill_lapd_byte_state(convo_data->byte_state_a, state, full_byte, bit_offset, ones, data, data_len); else { if (!convo_data->byte_state_b) - convo_data->byte_state_b = se_new(lapd_byte_state_t); + convo_data->byte_state_b = wmem_new(wmem_file_scope(), lapd_byte_state_t); fill_lapd_byte_state(convo_data->byte_state_b, state, full_byte, bit_offset, ones, data, data_len); } } else { /* lapd convo data has to be created */ - lapd_byte_state = se_new(lapd_byte_state_t); + lapd_byte_state = wmem_new(wmem_file_scope(), lapd_byte_state_t); fill_lapd_byte_state(lapd_byte_state, state, full_byte, bit_offset, ones, data, data_len); - convo_data = se_new(lapd_convo_data_t); + convo_data = wmem_new(wmem_file_scope(), lapd_convo_data_t); COPY_ADDRESS(&convo_data->addr_a, &pinfo->src); COPY_ADDRESS(&convo_data->addr_b, &pinfo->dst); convo_data->port_a = pinfo->srcport; diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c index 03745a6577..7cde6e2435 100644 --- a/epan/dissectors/packet-ldp.c +++ b/epan/dissectors/packet-ldp.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include @@ -1030,7 +1030,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre break; } - addr=(guint8 *)ep_alloc0(addr_size); + addr=(guint8 *)wmem_alloc0(wmem_packet_scope(), addr_size); for(ax=0; ax+1 <= prefix_len_octets; ax++) addr[ax]=tvb_get_guint8(tvb, offset+ax); @@ -1105,7 +1105,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre break; } - addr=(guint8 *)ep_alloc0(addr_size); + addr=(guint8 *)wmem_alloc0(wmem_packet_scope(), addr_size); for(ax=0; ax+1 <= host_len; ax++) addr[ax]=tvb_get_guint8(tvb, offset+ax); @@ -1395,7 +1395,7 @@ dissect_tlv_address_list(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem) ti=proto_tree_add_text(tree, tvb, offset, rem, "Addresses"); val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val); - addr=(guint8 *)ep_alloc(addr_size); + addr=(guint8 *)wmem_alloc(wmem_packet_scope(), addr_size); for(ix=1; rem >= addr_size; ix++, offset += addr_size, rem -= addr_size) { diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c index 39ffc7469a..c5ab0836a7 100644 --- a/epan/dissectors/packet-ldss.c +++ b/epan/dissectors/packet-ldss.c @@ -50,6 +50,7 @@ #include #include #include +#include #include /* The digest is up to 32 bytes long */ @@ -222,7 +223,7 @@ prepare_ldss_transfer_conv(ldss_broadcast_t *broadcast) conversation_t *transfer_conv; ldss_transfer_info_t *transfer_info; - transfer_info = se_new0(ldss_transfer_info_t); + transfer_info = wmem_new0(wmem_file_scope(), ldss_transfer_info_t); transfer_info->broadcast = broadcast; /* Preparation for later push/pull dissection */ @@ -410,7 +411,7 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ldss_broadcast_t *data; /* Populate data from the broadcast */ - data = se_new0(ldss_broadcast_t); + data = wmem_new0(wmem_file_scope(), ldss_broadcast_t); data->num = pinfo->fd->num; data->ts = pinfo->fd->abs_ts; data->message_id = messageID; @@ -420,11 +421,11 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) data->offset = offset; data->compression = compression; - data->file = se_new0(ldss_file_t); + data->file = wmem_new0(wmem_file_scope(), ldss_file_t); data->file->digest = digest; data->file->digest_type = digest_type; - data->broadcaster = se_new0(ldss_broadcaster_t); + data->broadcaster = wmem_new0(wmem_file_scope(), ldss_broadcaster_t); COPY_ADDRESS(&data->broadcaster->addr, &pinfo->src); data->broadcaster->port = port; @@ -493,8 +494,8 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) highest_num_seen < pinfo->fd->num) { already_dissected = FALSE; - transfer_info->req = se_new0(ldss_file_request_t); - transfer_info->req->file = se_new0(ldss_file_t); + transfer_info->req = wmem_new0(wmem_file_scope(), ldss_file_request_t); + transfer_info->req->file = wmem_new0(wmem_file_scope(), ldss_file_t); highest_num_seen = pinfo->fd->num; } @@ -607,7 +608,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(digest_bytes->len >= DIGEST_LEN) digest_bytes->len = (DIGEST_LEN-1); /* Ensure the digest is zero-padded */ - transfer_info->file->digest = (guint8 *)se_alloc0(DIGEST_LEN); + transfer_info->file->digest = (guint8 *)wmem_alloc0(wmem_file_scope(), DIGEST_LEN); memcpy(transfer_info->file->digest, digest_bytes->data, digest_bytes->len); g_byte_array_free(digest_bytes, TRUE); diff --git a/epan/dissectors/packet-lisp.c b/epan/dissectors/packet-lisp.c index e7e3300b52..5c00d7f656 100644 --- a/epan/dissectors/packet-lisp.c +++ b/epan/dissectors/packet-lisp.c @@ -30,6 +30,7 @@ #include #include #include +#include #define INET_ADDRLEN 4 #define INET6_ADDRLEN 16 @@ -373,7 +374,7 @@ get_addr_str(tvbuff_t *tvb, gint offset, guint16 afi, guint16 *addr_len) iid = tvb_get_ntohl(tvb, offset + LCAF_HEADER_LEN); afi = tvb_get_ntohs(tvb, offset + LCAF_HEADER_LEN + 4); addr_str = get_addr_str(tvb, offset + LCAF_HEADER_LEN + 6, afi, &cur_len); - return ep_strdup_printf("[%d] %s", iid, addr_str); + return wmem_strdup_printf(wmem_packet_scope(), "[%d] %s", iid, addr_str); } return addr_str; default: diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index 5afa56847d..c9919956d9 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -673,7 +673,7 @@ get_latitude_or_longitude(int option, guint64 value) direction = "East"; } - return ep_strdup_printf("%u.%04" G_GINT64_MODIFIER "u degrees %s", + return wmem_strdup_printf(wmem_packet_scope(), "%u.%04" G_GINT64_MODIFIER "u degrees %s", integerPortion, tempValue, direction); } @@ -2508,7 +2508,7 @@ dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tre subTypeStr = val_to_str(subType, ieee_802_1qbg_subtypes, "Unknown subtype 0x%x"); break; default: - subTypeStr = ep_strdup_printf("Unknown (%d)",subType); + subTypeStr = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",subType); break; } if (tree) -- cgit v1.2.3