Skip to content

Commit

Permalink
Apparently one of our major global headers must include emem.h, becau…
Browse files Browse the repository at this point in the history
…se I just

found a bunch more asn1 dissectors using emem without ever directly including
the header. Convert those to wmem as well, which involves add a number of
#include directives since dissectors do *not* automatically pull in the wmem
headers.

svn path=/trunk/; revision=50066
  • Loading branch information
eapache committed Jun 19, 2013
1 parent e6e7c11 commit 8b0f1ad
Show file tree
Hide file tree
Showing 39 changed files with 237 additions and 219 deletions.
2 changes: 1 addition & 1 deletion asn1/acse/acse.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ PDV-list/presentation-data-values/octet-aligned pDVList_octet_aligned

/* look up the indirect reference */
if((oid = find_oid_by_pres_ctx_id(actx->pinfo, indir_ref)) != NULL) {
object_identifier_id = ep_strdup(oid);
object_identifier_id = wmem_strdup(wmem_packet_scope(), oid);
}

if(session)
Expand Down
9 changes: 5 additions & 4 deletions asn1/ansi_map/packet-ansi_map-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
#include <epan/prefs.h>
#include <epan/tap.h>
#include <epan/asn1.h>
#include <epan/wmem/wmem.h>

#include "packet-ber.h"
#include "packet-ansi_map.h"
Expand Down Expand Up @@ -420,13 +421,13 @@ update_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb
/* The hash string needs to contain src and dest to distiguish differnt flows */
switch(ansi_map_response_matching_type){
case ANSI_MAP_TID_ONLY:
buf = ep_strdup(p_private_tcap->TransactionID_str);
buf = wmem_strdup(wmem_packet_scope(), p_private_tcap->TransactionID_str);
break;
case 1:
buf = ep_strdup_printf("%s%s",p_private_tcap->TransactionID_str,src_str);
buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",p_private_tcap->TransactionID_str,src_str);
break;
default:
buf = ep_strdup_printf("%s%s%s",p_private_tcap->TransactionID_str,src_str,dst_str);
buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",p_private_tcap->TransactionID_str,src_str,dst_str);
break;
}
/* If the entry allready exists don't owervrite it */
Expand Down Expand Up @@ -4290,7 +4291,7 @@ find_saved_invokedata(asn1_ctx_t *actx){
guint8 *dst_str;
char *buf;

buf=(char *)ep_alloc(1024);
buf=(char *)wmem_alloc(wmem_packet_scope(), 1024);

/* Data from the TCAP dissector */
if (actx->pinfo->private_data != NULL){
Expand Down
3 changes: 2 additions & 1 deletion asn1/dop/packet-dop-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <epan/oids.h>
#include <epan/asn1.h>
#include <epan/expert.h>
#include <epan/wmem/wmem.h>

#include "packet-ber.h"
#include "packet-acse.h"
Expand Down Expand Up @@ -89,7 +90,7 @@ call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet
{
char* binding_param;

binding_param = ep_strdup_printf("%s.%s", base_string, binding_type ? binding_type : "");
binding_param = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", base_string, binding_type ? binding_type : "");

col_append_fstr(pinfo->cinfo, COL_INFO, " %s", col_info);

Expand Down
4 changes: 2 additions & 2 deletions asn1/h225/h225.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ IsupNumber/nationalStandardPartyNumber isupNationalStandardPartyNumber
%(ACTX)s->value_ptr = &guid_tvb;
%(DEFAULT_BODY)s
if (guid_tvb)
tvb_get_ntohguid(guid_tvb, 0, call_id_guid = ep_new(e_guid_t));
tvb_get_ntohguid(guid_tvb, 0, call_id_guid = wmem_new(wmem_packet_scope(), e_guid_t));
%(ACTX)s->value_ptr = NULL;
#.END
#----------------------------------------------------------------------------------------
Expand Down Expand Up @@ -684,7 +684,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode
%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) gefx->id = ep_strdup_printf("%%u", value_int);
if (gefx) gefx->id = wmem_strdup_printf(wmem_packet_scope(), "%%u", value_int);
#.END
#.FN_BODY GenericIdentifier/oid FN_VARIANT = _str VAL_PTR = &oid_str
Expand Down
1 change: 1 addition & 0 deletions asn1/h225/packet-h225-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/wmem/wmem.h>

#include <string.h>

Expand Down
16 changes: 8 additions & 8 deletions asn1/h245/h245.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
const gchar *olc_key;
olc_info_t *olc_req;

upcoming_olc = (!actx->pinfo->fd->flags.visited) ? ep_new0(olc_info_t) : NULL;
upcoming_olc = (!actx->pinfo->fd->flags.visited) ? wmem_new0(wmem_packet_scope(), olc_info_t) : NULL;

h223_fw_lc_num = 0;
h223_rev_lc_num = 0;
Expand Down Expand Up @@ -632,7 +632,7 @@ if (h245_pi != NULL)

%(DEFAULT_BODY)s
if (gefx) {
gefx->subid = ep_strdup_printf("%%u", subMessageIdentifer);
gefx->subid = wmem_strdup_printf(wmem_packet_scope(), "%%u", subMessageIdentifer);
gef_ctx_update_key(gef_ctx_get(actx->private_data));
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG CapabilityIdentifier: %%s", gef_ctx_get(actx->private_data)->key);*/
}
Expand Down Expand Up @@ -763,7 +763,7 @@ if (h245_pi != NULL)

%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) gefx->id = ep_strdup_printf("%%d", value_int);
if (gefx) gefx->id = wmem_strdup_printf(wmem_packet_scope(), "%%d", value_int);
#.END
#----------------------------------------------------------------------------------------
#.FN_BODY ParameterValue/booleanArray VAL_PTR = &value
Expand All @@ -775,7 +775,7 @@ if (h245_pi != NULL)
%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
buf = ep_new(guint8);
buf = wmem_new(wmem_packet_scope(), guint8);
buf[0] = value;
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint8), sizeof(guint8));
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
Expand All @@ -792,7 +792,7 @@ if (h245_pi != NULL)
%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
buf = (guint8 *)ep_new(guint16);
buf = (guint8 *)wmem_new(wmem_packet_scope(), guint16);
phtons(buf, value);
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint16), sizeof(guint16));
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
Expand All @@ -809,7 +809,7 @@ if (h245_pi != NULL)
%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
buf = (guint8 *)ep_new(guint16);
buf = (guint8 *)wmem_new(wmem_packet_scope(), guint16);
phtons(buf, value);
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint16), sizeof(guint16));
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
Expand All @@ -826,7 +826,7 @@ if (h245_pi != NULL)
%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
buf = (guint8 *)ep_new(guint32);
buf = (guint8 *)wmem_new(wmem_packet_scope(), guint32);
phtonl(buf, value);
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint32), sizeof(guint32));
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
Expand All @@ -843,7 +843,7 @@ if (h245_pi != NULL)
%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
buf = (guint8 *)ep_new(guint32);
buf = (guint8 *)wmem_new(wmem_packet_scope(), guint32);
phtonl(buf, value);
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint32), sizeof(guint32));
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
Expand Down
6 changes: 3 additions & 3 deletions asn1/h248/h248.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ AuditReplyV1/auditResult audit_result
#.END

#.FN_HDR TerminationID
curr_info.term = ep_new0(gcp_term_t);
curr_info.term = wmem_new0(wmem_packet_scope(), gcp_term_t);
wild_term = GCP_WILDCARD_NONE;
#.END

Expand Down Expand Up @@ -352,8 +352,8 @@ AuditReplyV1/auditResult audit_result
}
} else {
curr_info.term->len = 0;
curr_info.term->buffer = (guint8*)ep_strdup("");
curr_info.term->str = ep_strdup("?");
curr_info.term->buffer = (guint8*)wmem_strdup(wmem_packet_scope(), "");
curr_info.term->str = wmem_strdup(wmem_packet_scope(), "?");
}
#.END

Expand Down
24 changes: 12 additions & 12 deletions asn1/h248/packet-h248-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,9 @@ extern void h248_param_PkgdName(proto_tree* tree, tvbuff_t* tvb, packet_info* pi
pi = proto_tree_add_uint(package_tree, hf_248_pkg_param, tvb, offset-2, 2, name_minor);

if (pkg->signal_names && ( strval = try_val_to_str(name_minor, pkg->signal_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",name_minor);
}

proto_item_set_text(pi,"Signal ID: %s", strval);
Expand Down Expand Up @@ -1034,9 +1034,9 @@ static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offse
const gchar* strval;

if (pkg->param_names && ( strval = try_val_to_str(name_minor, pkg->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",name_minor);
}

proto_item_set_text(pi,"Parameter: %s", strval);
Expand Down Expand Up @@ -1097,9 +1097,9 @@ static int dissect_h248_EventName(gboolean implicit_tag, tvbuff_t *tvb, int offs
const gchar* strval;

if (pkg->event_names && ( strval = try_val_to_str(name_minor, pkg->event_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",name_minor);
}

proto_item_set_text(pi,"Event ID: %s", strval);
Expand Down Expand Up @@ -1162,9 +1162,9 @@ static int dissect_h248_SignalName(gboolean implicit_tag , tvbuff_t *tvb, int of
const gchar* strval;

if (pkg->signal_names && ( strval = try_val_to_str(name_minor, pkg->signal_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
strval = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",name_minor);
}

proto_item_set_text(pi,"Signal ID: %s", strval);
Expand Down Expand Up @@ -1255,9 +1255,9 @@ static int dissect_h248_SigParameterName(gboolean implicit_tag _U_, tvbuff_t *tv
}

if (curr_info.sig && curr_info.sig->param_names && ( strval = try_val_to_str(param_id, curr_info.sig->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,param_id);
strval = wmem_strdup_printf(wmem_packet_scope(), "%s (%d)",strval,param_id);
} else {
strval = ep_strdup_printf("Unknown (%d)",param_id);
strval = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",param_id);
}

proto_item_set_text(pi,"Parameter: %s", strval);
Expand Down Expand Up @@ -1332,9 +1332,9 @@ static int dissect_h248_EventParameterName(gboolean implicit_tag _U_, tvbuff_t *
}

if (curr_info.evt && curr_info.evt->param_names && ( strval = try_val_to_str(param_id, curr_info.evt->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,param_id);
strval = wmem_strdup_printf(wmem_packet_scope(), "%s (%d)",strval,param_id);
} else {
strval = ep_strdup_printf("Unknown (%d)",param_id);
strval = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",param_id);
}

proto_item_set_text(pi,"Parameter: %s", strval);
Expand Down
5 changes: 3 additions & 2 deletions asn1/h323/packet-h323-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <epan/packet.h>
#include <epan/oids.h>
#include <epan/asn1.h>
#include <epan/wmem/wmem.h>

#include "packet-per.h"
#include "packet-h225.h"
Expand All @@ -43,7 +44,7 @@
gef_ctx_t* gef_ctx_alloc(gef_ctx_t *parent, const gchar *type) {
gef_ctx_t *gefx;

gefx = ep_new0(gef_ctx_t);
gefx = wmem_new0(wmem_packet_scope(), gef_ctx_t);
gefx->signature = GEF_CTX_SIGNATURE;
gefx->parent = parent;
gefx->type = type;
Expand Down Expand Up @@ -75,7 +76,7 @@ void gef_ctx_update_key(gef_ctx_t *gefx) {

if (!gefx) return;
parent_key = (gefx->parent) ? gefx->parent->key : NULL;
gefx->key = ep_strdup_printf(
gefx->key = wmem_strdup_printf(wmem_packet_scope(),
"%s%s" /* parent prefix */
"%s%s%s" /* type, id */
"%s%s" /* subid */,
Expand Down
1 change: 1 addition & 0 deletions asn1/h450-ros/packet-h450-ros-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <epan/strutil.h>
#include <epan/asn1.h>
#include <epan/expert.h>
#include <epan/wmem/wmem.h>

#include "packet-per.h"

Expand Down
14 changes: 7 additions & 7 deletions asn1/kerberos/kerberos.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ guint32 msgtype;

#.FN_BODY PADATA-TYPE

actx->value_ptr = ep_alloc(sizeof(guint32));
actx->value_ptr = wmem_alloc(wmem_packet_scope(), sizeof(guint32));

offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
(guint32*)actx->value_ptr);
Expand Down Expand Up @@ -187,7 +187,7 @@ guint32 msgtype;
addr_type = *((guint32*)actx->value_ptr);
}

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:
Expand Down Expand Up @@ -228,7 +228,7 @@ guint32 msgtype;
#xxx TYPE = FT_UINT16 DISPLAY = BASE_DEC STRINGS = VALS(xx_vals)

#.FN_BODY ENCTYPE
actx->value_ptr = ep_alloc(sizeof(guint32));
actx->value_ptr = wmem_alloc(wmem_packet_scope(), sizeof(guint32));

offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
(guint32*)actx->value_ptr);
Expand Down Expand Up @@ -291,7 +291,7 @@ guint32 msgtype;


#.FN_BODY CKSUMTYPE
actx->value_ptr = ep_alloc(sizeof(guint32));
actx->value_ptr = wmem_alloc(wmem_packet_scope(), sizeof(guint32));

offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
(guint32*)actx->value_ptr);
Expand All @@ -315,7 +315,7 @@ guint32 msgtype;
return offset;

#.FN_BODY EncryptionKey/keytype
kerberos_key_t* key = (kerberos_key_t*)ep_alloc(sizeof(kerberos_key_t));
kerberos_key_t* key = (kerberos_key_t*)wmem_alloc(wmem_packet_scope(), sizeof(kerberos_key_t));
actx->value_ptr = key;

offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
Expand Down Expand Up @@ -344,7 +344,7 @@ guint32 msgtype;
}

#.FN_BODY AuthorizationData/_item/ad-type
actx->value_ptr = ep_alloc(sizeof(guint32));
actx->value_ptr = wmem_alloc(wmem_packet_scope(), sizeof(guint32));

offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
(guint32*)actx->value_ptr);
Expand All @@ -365,7 +365,7 @@ guint32 msgtype;
}

#.FN_BODY HostAddress/addr-type
actx->value_ptr = ep_alloc(sizeof(guint32));
actx->value_ptr = wmem_alloc(wmem_packet_scope(), sizeof(guint32));

offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
(guint32*)actx->value_ptr);
Expand Down
Loading

0 comments on commit 8b0f1ad

Please sign in to comment.