Dario Lombardo <lomato@gmail.com> via

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9147

Migration from emem to wmem for trivial cases (ep_alloc only).


svn path=/trunk/; revision=52002
This commit is contained in:
Jörg Mayer 2013-09-13 10:13:19 +00:00
parent 1e762e315d
commit 23d3e3d665
20 changed files with 75 additions and 70 deletions

View File

@ -31,6 +31,7 @@
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/in_cksum.h>
#include <epan/wmem/wmem.h>
#include <epan/oui.h>
#include <epan/nlpid.h>
@ -245,7 +246,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (data_length & 1) {
guint8 *padded_buffer;
/* Allocate new buffer */
padded_buffer = (guint8 *)ep_alloc(data_length+1);
padded_buffer = (guint8 *)wmem_alloc(wmem_packet_scope(), data_length+1);
tvb_memcpy(tvb, padded_buffer, 0, data_length);
/* Swap bytes in last word */
padded_buffer[data_length] = padded_buffer[data_length-1];

View File

@ -33,6 +33,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/wmem/wmem.h>
#define CIMD_STX 0x02 /* Start of CIMD PDU */
#define CIMD_ETX 0x03 /* End of CIMD PDU */
@ -408,7 +409,7 @@ static void dissect_cimd_ud(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint s
payloadText = tvb_format_text(tvb, g_offset, g_size);
size = (int)strlen(payloadText);
tmpBuffer = (gchar*)ep_alloc(size+1);
tmpBuffer = (gchar*)wmem_alloc(wmem_packet_scope(), size+1);
for (loop = 0; loop < size; loop++)
{
if (payloadText[loop] == '_')
@ -454,7 +455,7 @@ static void dissect_cimd_ud(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint s
tmpBuffer[bufPoz] = '\0';
size1 = (int)strlen(tmpBuffer);
tmpBuffer1 = (gchar*)ep_alloc(size1+1);
tmpBuffer1 = (gchar*)wmem_alloc(wmem_packet_scope(), size1+1);
for (loop=0; loop<size1; loop++)
{
ch = tmpBuffer[loop];
@ -607,7 +608,7 @@ static void dissect_cimd_dcs(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint
guint dcs_is; /* indication sense */
guint dcs_it; /* indication type */
gchar* bigbuf = (gchar*)ep_alloc(1024);
gchar* bigbuf = (gchar*)wmem_alloc(wmem_packet_scope(), 1024);
param_item = proto_tree_add_text(tree, tvb,
startOffset + 1, endOffset - (startOffset + 1),

View File

@ -28,7 +28,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include "packet-dcerpc.h"
@ -85,7 +85,7 @@ PIDL_dissect_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo,
hf_info = proto_registrar_get_nth(hfindex);
valstr = (char *)ep_alloc(64);
valstr = (char *)wmem_alloc(wmem_packet_scope(), 64);
valstr[0]=0;
switch (hf_info->display) {
@ -169,7 +169,7 @@ PIDL_dissect_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo,
hf_info = proto_registrar_get_nth(hfindex);
valstr = (char *)ep_alloc(64);
valstr = (char *)wmem_alloc(wmem_packet_scope(), 64);
valstr[0]=0;
switch (hf_info->display) {
@ -300,7 +300,7 @@ PIDL_dissect_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo,
hf_info = proto_registrar_get_nth(hfindex);
valstr = (char *)ep_alloc(64);
valstr = (char *)wmem_alloc(wmem_packet_scope(), 64);
valstr[0]=0;
switch (hf_info->display) {
@ -417,7 +417,7 @@ PIDL_dissect_uint64(tvbuff_t *tvb, gint offset, packet_info *pinfo,
hf_info = proto_registrar_get_nth(hfindex);
valstr = (char *)ep_alloc(64);
valstr = (char *)wmem_alloc(wmem_packet_scope(), 64);
valstr[0]=0;
switch (hf_info->display) {

View File

@ -28,7 +28,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/aftypes.h>
#include <string.h>
@ -428,7 +428,7 @@ static gint display_unicode_string(proto_tree *tree, gint hf_index, tvbuff_t *tv
* Allocate a buffer for the string; "len" is the length in
* bytes, not the length in characters.
*/
str = (char *)ep_alloc(len/2);
str = (char *)wmem_alloc(wmem_packet_scope(), len/2);
/*
* XXX - this assumes the string is just ISO 8859-1; we need
@ -1745,4 +1745,3 @@ void proto_reg_handoff_dplay(void)
heur_dissector_add("udp", heur_dissect_dplay, proto_dplay);
heur_dissector_add("tcp", heur_dissect_dplay, proto_dplay);
}

View File

@ -33,6 +33,8 @@
#include "packet-nfs.h"
#include "packet-hclnfsd.h"
#include <epan/wmem/wmem.h>
static int proto_hclnfsd = -1;
static int hf_hclnfsd_procedure_v1 = -1;
static int hf_hclnfsd_request_type = -1;
@ -150,7 +152,7 @@ hclnfsd_decode_obscure(const char *ident, int ident_len)
char *ident_decoded, *ident_out;
int j, x, y;
ident_decoded = (char *)ep_alloc(ident_len);
ident_decoded = (char *)wmem_alloc(wmem_packet_scope(), ident_len);
ident_out = ident_decoded;
for (x = -1, j = 0; j < ident_len; j++)
{

View File

@ -27,6 +27,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/wmem/wmem.h>
#include "packet-ieee80211.h"
#define SHORT_STR 256
@ -153,7 +154,7 @@ static gint ett_prism_did = -1;
#define PRISM_TYPE1_MACTIME 0x00020044 /* Mac time element */
#define PRISM_TYPE2_MACTIME 0x00002041
#define PRISM_TYPE1_CHANNEL 0x00030044 /* Channel element */
#define PRISM_TYPE2_CHANNEL 0x00003041
#define PRISM_TYPE2_CHANNEL 0x00003041
#define PRISM_TYPE1_RSSI 0x00040044 /* RSSI element */
#define PRISM_TYPE2_RSSI 0x00004041
#define PRISM_TYPE1_SQ 0x00050044 /* SQ element */
@ -223,7 +224,7 @@ static gchar *
prism_rate_return(guint32 rate)
{
gchar *result=NULL;
result = (gchar *)ep_alloc(SHORT_STR);
result = (gchar *)wmem_alloc(wmem_packet_scope(), SHORT_STR);
result[0] = '\0';
prism_rate_base_custom(result, rate);

View File

@ -29,6 +29,7 @@
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/wmem/wmem.h>
#include "packet-ssl.h"
#include <stdio.h>
@ -80,8 +81,8 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int iter;
int commandlen;
tokenbuf = (guchar *)ep_alloc(MAX_BUFFER);
command_token = (guchar *)ep_alloc(MAX_BUFFER);
tokenbuf = (guchar *)wmem_alloc(wmem_packet_scope(), MAX_BUFFER);
command_token = (guchar *)wmem_alloc(wmem_packet_scope(), MAX_BUFFER);
memset(tokenbuf, '\0', MAX_BUFFER);
memset(command_token, '\0', MAX_BUFFER);
commandlen = 0;
@ -158,7 +159,7 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/*
* Extract second token, and, if there is a second
* Extract second token, and, if there is a second
* token, and it's not uid, add it as the request or reply command.
*/
tokenlen = get_token_len(line, line + linelen, &next_token);
@ -169,7 +170,7 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if ( TRUE == is_request && strncmp(tokenbuf,"uid",tokenlen) == 0) {
proto_tree_add_item(reqresp_tree, hf_imap_request_uid, tvb, offset, tokenlen, ENC_ASCII|ENC_NA);
/*
* UID is a precursor to a command, if following the tag,
* UID is a precursor to a command, if following the tag,
* so move to next token to grab the actual command.
*/
uid_offset = offset;

View File

@ -31,7 +31,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
static int proto_ipars = -1;
static guint8 ipars_eomtype = G_MAXUINT8;
@ -58,7 +58,7 @@ dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
int offset = 0;
gchar *eom_msg;
eom_msg = (gchar *)ep_alloc(MAX_EOM_MSG_SIZE);
eom_msg = (gchar *)wmem_alloc(wmem_packet_scope(), MAX_EOM_MSG_SIZE);
eom_msg[0] = 0;
col_clear(pinfo->cinfo, COL_INFO);

View File

@ -84,7 +84,7 @@
#include <epan/strutil.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/asn1.h>
#include <epan/expert.h>
#include <epan/dissectors/packet-kerberos.h>
@ -1813,7 +1813,7 @@ static int dissect_krb5_address(proto_tree *tree, tvbuff_t *tvb, int offset, asn
offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &appclass, &pc, &tag);
offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL);
address_str=(char *)ep_alloc(ADDRESS_STR_BUFSIZ);
address_str=(char *)wmem_alloc(wmem_packet_scope(), ADDRESS_STR_BUFSIZ);
address_str[0]='\0';
switch(addr_type){
case KRB5_ADDR_IPv4:

View File

@ -38,6 +38,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/reassemble.h>
#include <epan/wmem/wmem.h>
static int proto_lapsat = -1;
@ -268,7 +269,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int is_
const char *frame_type;
char *info;
info = (char *)ep_alloc(80);
info = (char *)wmem_alloc(wmem_packet_scope(), 80);
/* Grab complete control field */
ctl = tvb_get_ntohs(tvb, 1) >> 4;

View File

@ -30,7 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
/* Initialize the protocol and registered fields */
static int proto_manolito = -1;
@ -166,7 +166,7 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* widen it past 8 bits, so there shouldn't
* be an overflow.
*/
data = (guint8 *)ep_alloc((guint)length + 1);
data = (guint8 *)wmem_alloc(wmem_packet_scope(), (guint)length + 1);
tvb_memcpy(tvb, data, ++offset, length);
offset += length;
@ -278,4 +278,3 @@ proto_reg_handoff_manolito(void)
proto_manolito);
dissector_add_uint("udp.port", 41170, manolito_handle);
}

View File

@ -30,7 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/prefs.h>
#include <epan/strutil.h>
#include <epan/show_exception.h>
@ -172,8 +172,8 @@ static const true_false_string tfs_flags_broadcast = {
"Not a broadcast packet"
};
static const true_false_string tfs_nbss_flags_e = {
"Add 65536 to length",
static const true_false_string tfs_nbss_flags_e = {
"Add 65536 to length",
"Add 0 to length"
};
@ -316,7 +316,7 @@ get_nbns_name(tvbuff_t *tvb, int offset, int nbns_data_offset,
char *pname_ret;
size_t idx = 0;
nbname_buf = (char *)ep_alloc(NBNAME_BUF_LEN);
nbname_buf = (char *)wmem_alloc(wmem_packet_scope(), NBNAME_BUF_LEN);
nbname = nbname_buf;
/* XXX Fix data len */
name_len = get_dns_name(tvb, offset, 0, nbns_data_offset, &name);
@ -453,7 +453,7 @@ dissect_nbns_query(tvbuff_t *tvb, int offset, int nbns_data_offset,
proto_tree *q_tree;
proto_item *tq;
name = (char *)ep_alloc(MAX_NAME_LEN);
name = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN);
data_start = data_offset = offset;
name_len = MAX_NAME_LEN;
@ -510,7 +510,7 @@ nbns_add_nbns_flags(column_info *cinfo, proto_tree *nbns_tree, tvbuff_t *tvb, in
if (!nbns_tree)
return;
buf = (char *)ep_alloc(MAX_BUF_SIZE);
buf = (char *)wmem_alloc(wmem_packet_scope(), MAX_BUF_SIZE);
opcode = (guint16) ((flags & F_OPCODE) >> OPCODE_SHIFT);
g_snprintf(buf, MAX_BUF_SIZE, "%s", val_to_str_const(opcode, opcode_vals, "Unknown operation"));
if (flags & F_RESPONSE && !is_wack) {
@ -562,7 +562,7 @@ nbns_add_nb_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset)
proto_tree_add_item(field_tree, hf_nbns_nb_flags_group, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(field_tree, hf_nbns_nb_flags_ont, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(tf, "(%s, %s",
proto_item_append_text(tf, "(%s, %s",
val_to_str_const(flags & NB_FLAGS_ONT, nb_flags_ont_vals, "Unknown"),
(flags & NB_FLAGS_G) ? "group" : "unique");
}
@ -587,18 +587,18 @@ nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset)
proto_tree_add_item(field_tree, hf_nbns_name_flags_act, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(field_tree, hf_nbns_name_flags_prm, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(tf, "(%s, %s",
proto_item_append_text(tf, "(%s, %s",
val_to_str_const(flags & NAME_FLAGS_ONT, name_flags_ont_vals, "Unknown"),
(flags & NAME_FLAGS_G) ? "group" : "unique");
if (flags & NAME_FLAGS_DRG)
proto_item_append_text(tf, ", being deregistered");
proto_item_append_text(tf, ", being deregistered");
if (flags & NAME_FLAGS_CNF)
proto_item_append_text(tf, ", in conflict");
proto_item_append_text(tf, ", in conflict");
if (flags & NAME_FLAGS_ACT)
proto_item_append_text(tf, ", active");
proto_item_append_text(tf, ", active");
if (flags & NAME_FLAGS_PRM)
proto_item_append_text(tf, ", permanent node name");
proto_item_append_text(tf, ")");
proto_item_append_text(tf, ", permanent node name");
proto_item_append_text(tf, ")");
}
static int
@ -625,9 +625,9 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset,
cur_offset = offset;
name = (char *)ep_alloc(MAX_NAME_LEN);
name_str = (char *)ep_alloc(MAX_NAME_LEN);
nbname = (char *)ep_alloc(16+4+1); /* 4 for [<last char>] */
name = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN);
name_str = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN);
nbname = (char *)wmem_alloc(wmem_packet_scope(), 16+4+1); /* 4 for [<last char>] */
name_len = MAX_NAME_LEN;
len = get_nbns_name_type_class(tvb, offset, nbns_data_offset, name,
@ -1223,7 +1223,7 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int name_type;
int len;
name = (char *)ep_alloc(MAX_NAME_LEN);
name = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBDS");
col_clear(pinfo->cinfo, COL_INFO);
@ -1430,7 +1430,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
const char *saved_proto;
void *pd_save;
name = (char *)ep_alloc(MAX_NAME_LEN);
name = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN);
/* Desegmentation */
length_remaining = tvb_length_remaining(tvb, offset);

View File

@ -28,7 +28,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include "packet-ncp-int.h"
#include "packet-ncp-nmas.h"
@ -206,7 +206,7 @@ nmas_string(tvbuff_t* tvb, int hfinfo, proto_tree *nmas_tree, int offset, gboole
guint16 c_char;
guint32 length_remaining = 0;
buffer = (char *)ep_alloc(ITEM_LABEL_LENGTH+1);
buffer = (char *)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH+1);
if (little) {
str_length = tvb_get_letohl(tvb, foffset);
} else {
@ -773,4 +773,3 @@ proto_register_nmas(void)
* vi: set shiftwidth=4 tabstop=4 expandtab:
* :indentSize=4:tabSize=4:noTabs=true:
*/

View File

@ -28,6 +28,7 @@
#include <glib.h>
#include "epan/packet.h"
#include <epan/wmem/wmem.h>
#define OPCODE_C_context 0
#define OPCODE_C_terminal 1
@ -856,7 +857,7 @@ static char *decode_key_name(int unicode)
{
char *key_name;
key_name = (char *)ep_alloc(10);
key_name = (char *)wmem_alloc(wmem_packet_scope(), 10);
if ((unicode <= 0x20)
|| (unicode == 0x7F)
@ -1115,7 +1116,7 @@ static void decode_evt(proto_tree *tree,
pt_length -= 1;
}
unicode_value = decode_utf8(utf8_value);
key_name = (char *)ep_alloc(30);
key_name = (char *)wmem_alloc(wmem_packet_scope(), 30);
g_snprintf(key_name, 30, "\"%s\"", decode_key_name((int)unicode_value));
/* add text to the frame "INFO" column */

View File

@ -33,7 +33,7 @@
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/tvbparse.h>
@ -613,7 +613,7 @@ tvb_mip6_fmt_ts(tvbuff_t *tvb, gint offset)
}
fractime = bd->tm_sec + tempfrac / NTP_FLOAT_DENOM;
buff=(char *)ep_alloc(NTP_TS_SIZE);
buff=(char *)wmem_alloc(wmem_packet_scope(), NTP_TS_SIZE);
g_snprintf(buff, NTP_TS_SIZE,
"%s %2d, %d %02d:%02d:%07.4f UTC",
mon_names[bd->tm_mon],
@ -655,7 +655,7 @@ tvb_ntp_fmt_ts(tvbuff_t *tvb, gint offset)
}
fractime = bd->tm_sec + tempfrac / NTP_FLOAT_DENOM;
buff=(char *)ep_alloc(NTP_TS_SIZE);
buff=(char *)wmem_alloc(wmem_packet_scope(), NTP_TS_SIZE);
g_snprintf(buff, NTP_TS_SIZE,
"%s %2d, %d %02d:%02d:%09.6f UTC",
mon_names[bd->tm_mon],
@ -831,7 +831,7 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
* But, all V3 and V4 servers set this to IP address of their
* higher level server. My decision was to resolve this address.
*/
buff = (gchar *)ep_alloc(NTP_TS_SIZE);
buff = (gchar *)wmem_alloc(wmem_packet_scope(), NTP_TS_SIZE);
if (stratum <= 1) {
g_snprintf (buff, NTP_TS_SIZE, "Unidentified reference source '%.4s'",
tvb_get_ephemeral_string(tvb, 12, 4));

View File

@ -67,7 +67,7 @@
#include <epan/packet.h>
#include <epan/ipproto.h>
#include <epan/in_cksum.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/addr_resolv.h>
#include "packet-rsvp.h"
@ -990,7 +990,7 @@ dissect_ospf_bitfield (proto_tree *parent_tree, tvbuff_t *tvb, int offset,
item = proto_tree_add_uint(parent_tree, hfindex, tvb, offset, length, flags);
tree = proto_item_add_subtree(item, *bfinfo->ett);
str = (char *)ep_alloc(MAX_OPTIONS_LEN);
str = (char *)wmem_alloc(wmem_packet_scope(), MAX_OPTIONS_LEN);
str[0] = 0;
for (i = 0, pos = 0; i < bfinfo->num; i++) {
idx = hf_ospf_filter[bfinfo->idx[i]];

View File

@ -37,6 +37,7 @@ Protocol information comes from the book
#include "packet-rpc.h"
#include "packet-pcnfsd.h"
#include <epan/wmem/wmem.h>
static int proto_pcnfsd = -1;
static int hf_pcnfsd_procedure_v1 = -1;
@ -176,7 +177,7 @@ pcnfsd_decode_obscure(const char* data, int len)
char *decoded_buf;
char *decoded_data;
decoded_buf = (char *)ep_alloc(len);
decoded_buf = (char *)wmem_alloc(wmem_packet_scope(), len);
decoded_data = decoded_buf;
for ( ; len>0 ; len--, data++, decoded_data++) {
*decoded_data = (*data ^ 0x5b) & 0x7f;
@ -249,7 +250,7 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
if (password) {
/* Only attempt to decode the password if it has been specified */
if (strcmp(password, RPC_STRING_EMPTY))
if (strcmp(password, RPC_STRING_EMPTY))
pcnfsd_decode_obscure(password, (int)strlen(password));
if (password_tree)
@ -444,4 +445,3 @@ proto_reg_handoff_pcnfsd(void)
rpc_init_proc_table(PCNFSD_PROGRAM, 1, pcnfsd1_proc, hf_pcnfsd_procedure_v1);
rpc_init_proc_table(PCNFSD_PROGRAM, 2, pcnfsd2_proc, hf_pcnfsd_procedure_v2);
}

View File

@ -34,7 +34,7 @@
#include <epan/addr_resolv.h>
#include <epan/strutil.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/ptvcursor.h>
/*
@ -257,7 +257,7 @@ optsstr(guint8 opts)
if (opts == 0)
return("");
msg=(char *)ep_alloc(MAX_STR_LEN);
msg=(char *)wmem_alloc(wmem_packet_scope(), MAX_STR_LEN);
if (opts & PGM_OPT){
returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "Present");
idx += MIN(returned_length, MAX_STR_LEN-idx);
@ -289,7 +289,7 @@ paritystr(guint8 parity)
if (parity == 0)
return("");
msg=(char *)ep_alloc(MAX_STR_LEN);
msg=(char *)wmem_alloc(wmem_packet_scope(), MAX_STR_LEN);
if (parity & PGM_OPT_PARITY_PRM_PRO){
returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "Pro-active");
idx += MIN(returned_length, MAX_STR_LEN-idx);
@ -506,7 +506,7 @@ dissect_pgmopts(ptvcursor_t* cursor, const char *pktname)
firsttime = TRUE;
soffset = 0;
naks = (int)(optdata_len/sizeof(guint32));
nakbuf = (unsigned char *)ep_alloc(8192);
nakbuf = (unsigned char *)wmem_alloc(wmem_packet_scope(), 8192);
j = 0;
/*
* Print out 8 per line

View File

@ -30,7 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/strutil.h>
#include "packet-smb-common.h"
@ -100,7 +100,7 @@ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_i
* Allocate a buffer for the string; "len" is the length in
* bytes, not the length in characters.
*/
str = (char *)ep_alloc(len/2);
str = (char *)wmem_alloc(wmem_packet_scope(), len/2);
/*
* XXX - this assumes the string is just ISO 8859-1; we need
@ -163,7 +163,7 @@ unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, gboolean exactlen,
int us_len;
gboolean overflow = FALSE;
cur=(gchar *)ep_alloc(MAX_UNICODE_STR_LEN+3+1);
cur=(gchar *)wmem_alloc(wmem_packet_scope(), MAX_UNICODE_STR_LEN+3+1);
p = cur;
len = MAX_UNICODE_STR_LEN;
us_len = 0;
@ -265,7 +265,7 @@ get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp,
/*
* The string we return must be null-terminated.
*/
cur=(gchar *)ep_alloc(MAX_UNICODE_STR_LEN+3+1);
cur=(gchar *)wmem_alloc(wmem_packet_scope(), MAX_UNICODE_STR_LEN+3+1);
copylen = *len;
if (copylen < 0) {

View File

@ -46,7 +46,7 @@
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include "packet-tcp.h"
#include <epan/expert.h>
@ -459,7 +459,7 @@ unicode_to_bytes(tvbuff_t *tvb, int offset, int length, gboolean endianness)
return "";
if (endianness) {
byte_array = (guint8 *)ep_alloc(length*2 + 1);
byte_array = (guint8 *)wmem_alloc(wmem_packet_scope(), length*2 + 1);
for (i = length; i > 0; i--) {
c_char = ascii_text[i];
if (c_char != 0) {
@ -478,7 +478,7 @@ unicode_to_bytes(tvbuff_t *tvb, int offset, int length, gboolean endianness)
}
else
{
byte_array = (guint8 *)ep_alloc(length + 1);
byte_array = (guint8 *)wmem_alloc(wmem_packet_scope(), length + 1);
for (i = 0; i < length; i++) {
c_char = ascii_text[i];
if (c_char != 0) {