More wmem.

svn path=/trunk/; revision=51968
This commit is contained in:
Evan Huus 2013-09-12 12:37:27 +00:00
parent 343772cbcf
commit 58a9f5cb1e
8 changed files with 28 additions and 25 deletions

View File

@ -7,7 +7,7 @@
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* By Deepti Ragha <dlragha@ncsu.edu>
* By Deepti Ragha <dlragha@ncsu.edu>
* Copyright 2012 Deepti Ragha
*
* This program is free software; you can redistribute it and/or
@ -33,7 +33,7 @@
#include <epan/strutil.h>
#include <epan/arptypes.h>
#include <epan/addr_resolv.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include "packet-arp.h"
#include <epan/etypes.h>
#include <epan/arcnet_pids.h>
@ -403,7 +403,7 @@ atmarpnum_to_str(const guint8 *ad, int ad_tl)
/*
* I'm assuming this means it's an ASCII (IA5) string.
*/
cur = (gchar *)ep_alloc(MAX_E164_STR_LEN+3+1);
cur = (gchar *)wmem_alloc(wmem_packet_scope(), MAX_E164_STR_LEN+3+1);
if (ad_len > MAX_E164_STR_LEN) {
/* Can't show it all. */
memcpy(cur, ad, MAX_E164_STR_LEN);
@ -666,10 +666,10 @@ check_for_duplicate_addresses(packet_info *pinfo, proto_tree *tree,
else
{
/* Create result and store in result table */
duplicate_result_key *persistent_key = se_new(duplicate_result_key);
duplicate_result_key *persistent_key = wmem_new(wmem_file_scope(), duplicate_result_key);
memcpy(persistent_key, &result_key, sizeof(duplicate_result_key));
result = se_new(address_hash_value);
result = wmem_new(wmem_file_scope(), address_hash_value);
memcpy(result, value, sizeof(address_hash_value));
g_hash_table_insert(duplicate_result_hash_table, persistent_key, result);
@ -679,7 +679,7 @@ check_for_duplicate_addresses(packet_info *pinfo, proto_tree *tree,
else
{
/* No existing entry. Prepare one */
value = se_new(struct address_hash_value);
value = wmem_new(wmem_file_scope(), struct address_hash_value);
memcpy(value->mac, mac, 6);
value->frame_num = pinfo->fd->num;
value->time_of_entry = pinfo->fd->abs_ts.secs;

View File

@ -31,7 +31,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/prefs.h>
#include <wsutil/str_util.h>
@ -119,7 +119,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
hash_info = (exec_hash_entry_t *)conversation_get_proto_data(conversation, proto_exec);
if(!hash_info){
hash_info = se_new(exec_hash_entry_t);
hash_info = wmem_new(wmem_file_scope(), exec_hash_entry_t);
hash_info->first_packet_number = pinfo->fd->num;
hash_info->second_packet_number = 0;
@ -260,7 +260,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* info column of the entire conversation
*/
if(!hash_info->username){
hash_info->username=se_strdup((gchar*)field_stringz);
hash_info->username=wmem_strdup(wmem_file_scope(), (gchar*)field_stringz);
}
/* Next field we need */
@ -311,7 +311,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* info column of the entire conversation
*/
if(!hash_info->command){
hash_info->command=se_strdup((gchar*)field_stringz);
hash_info->command=wmem_strdup(wmem_file_scope(), (gchar*)field_stringz);
}
} else {

View File

@ -42,7 +42,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/prefs.h>
#include <epan/asn1.h>
#include <epan/dissectors/packet-x509af.h>
@ -1356,7 +1356,7 @@ dissect_mikey(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
mikey = (mikey_t *)p_get_proto_data(pinfo->fd, proto_mikey, 0);
if (!mikey) {
mikey = se_new0(mikey_t);
mikey = wmem_new0(wmem_file_scope(), mikey_t);
mikey->type = -1;
p_add_proto_data(pinfo->fd, proto_mikey, 0, mikey);
}

View File

@ -44,7 +44,6 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/etypes.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/expert.h>
#include <epan/reassemble.h>
@ -1502,11 +1501,11 @@ dissect_opensafety_snmt_message(tvbuff_t *message_tvb, packet_info *pinfo , prot
if ( global_scm_udid_autoset == TRUE )
{
tempString = (char *)ep_alloc0(128 * sizeof(char));
tempString = (char *)wmem_alloc0(wmem_packet_scope(), 128 * sizeof(char));
g_snprintf ( tempString, 18, "%s", tvb_bytes_to_str_punct(message_tvb, OSS_FRAME_POS_DATA + frameStart1 + 1, 6, ':' ) );
if ( memcmp ( global_scm_udid, tempString, 17 ) != 0 )
{
local_scm_udid = (char *)se_alloc0(18 * sizeof(char));
local_scm_udid = (char *)wmem_alloc0(wmem_file_scope(), 18 * sizeof(char));
g_snprintf(local_scm_udid, 18, "%s", tempString );
expert_add_info_format(pinfo, item, &ei_scmudid_autodetected, "Auto detected payload as SCM UDID [%s].", tempString);
}
@ -1533,11 +1532,11 @@ dissect_opensafety_snmt_message(tvbuff_t *message_tvb, packet_info *pinfo , prot
if ( global_scm_udid_autoset == TRUE )
{
tempString = (char *)ep_alloc0(18 * sizeof(char));
tempString = (char *)wmem_alloc0(wmem_packet_scope(), 18 * sizeof(char));
g_snprintf ( tempString, 18, "%s", tvb_bytes_to_str_punct(message_tvb, OSS_FRAME_POS_DATA + frameStart1 + 1, 6, ':' ) );
if ( memcmp ( global_scm_udid, tempString, 17 ) != 0 )
{
local_scm_udid = (char *)se_alloc0(18 * sizeof(char));
local_scm_udid = (char *)wmem_alloc0(wmem_file_scope(), 18 * sizeof(char));
g_snprintf(local_scm_udid, 18, "%s", tempString );
expert_add_info_format(pinfo, item, &ei_scmudid_autodetected, "Auto detected payload as SCM UDID [%s].", tempString);
}

View File

@ -37,6 +37,7 @@
#include <epan/conversation.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
#include <epan/wmem/wmem.h>
#include "packet-ssl.h"
static int proto_pop = -1;
@ -151,7 +152,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* No conversation - create one and attach it.
*/
data_val = se_new0(struct pop_data_val);
data_val = wmem_new0(wmem_file_scope(), struct pop_data_val);
conversation_add_proto_data(conversation, proto_pop, data_val);
}
@ -220,7 +221,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
data_val->msg_read_len += tvb_length(tvb);
frame_data_p = se_new(struct pop_proto_data);
frame_data_p = wmem_new(wmem_file_scope(), struct pop_proto_data);
frame_data_p->conversation_id = conversation->index;
frame_data_p->more_frags = data_val->msg_read_len < data_val->msg_tot_len;

View File

@ -70,6 +70,8 @@
#include "packet-udp.h"
#include <epan/strutil.h>
#include <epan/wmem/wmem.h>
#define TCP_PORT_SOCKS 1080
@ -993,7 +995,7 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
state_info = (sock_state_t *)p_get_proto_data(pinfo->fd, proto_socks, 0);
if (state_info == NULL) {
state_info = se_new(sock_state_t);
state_info = wmem_new(wmem_file_scope(), sock_state_t);
state_info->in_socks_dissector_flag = 0;
state_info->client = clientNoInit;
state_info->server = serverNoInit;
@ -1020,7 +1022,7 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
hash_info = (socks_hash_entry_t *)conversation_get_proto_data(conversation,proto_socks);
if (hash_info == NULL){
hash_info = se_new0(socks_hash_entry_t);
hash_info = wmem_new0(wmem_file_scope(), socks_hash_entry_t);
hash_info->start_done_frame = G_MAXINT;
hash_info->clientState = clientStart;
hash_info->serverState = serverStart;

View File

@ -34,7 +34,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/expert.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#define SPICE_MAGIC 0x52454451 /* = "REDQ" */
@ -3115,7 +3115,7 @@ dissect_spice(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
spice_info = (spice_conversation_t*)conversation_get_proto_data(conversation, proto_spice);
if (!spice_info) {
spice_info = se_new0(spice_conversation_t);
spice_info = wmem_new0(wmem_file_scope(), spice_conversation_t);
spice_info->destport = pinfo->destport;
spice_info->channel_type = SPICE_CHANNEL_NONE;
spice_info->next_state = SPICE_LINK_CLIENT;
@ -3130,7 +3130,7 @@ dissect_spice(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
per_packet_info = (spice_packet_t *)p_get_proto_data(pinfo->fd, proto_spice, 0);
if (!per_packet_info) {
per_packet_info = se_new(spice_packet_t);
per_packet_info = wmem_new(wmem_file_scope(), spice_packet_t);
per_packet_info->state = spice_info->next_state;
p_add_proto_data(pinfo->fd, proto_spice, 0, per_packet_info);
}

View File

@ -41,6 +41,7 @@
#include <epan/prefs.h>
#include <epan/conversation.h>
#include <epan/expert.h>
#include <epan/wmem/wmem.h>
#include "packet-sprt.h"
@ -816,7 +817,7 @@ void sprt_add_address(packet_info *pinfo,
*/
if (!p_conv_data) {
/* Create conversation data */
p_conv_data = se_new(struct _sprt_conversation_info);
p_conv_data = wmem_new(wmem_file_scope(), struct _sprt_conversation_info);
p_conv_data->stream_started = FALSE;
p_conv_data->seqnum[0] = 0;
p_conv_data->seqnum[1] = 0;