aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-per.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2009-10-06 19:15:58 +0000
committerAnders Broman <anders.broman@ericsson.com>2009-10-06 19:15:58 +0000
commitbc9a809b65612063457f882a2d732707879ecb01 (patch)
tree012cd52cad567bcc246d8749709f1b72ebe86356 /epan/dissectors/packet-per.c
parent0f4d4344dd770cf06b0c4aaa9f945acc99f314d5 (diff)
From Didier Gautheron:
ep memory can't be used for tvbs defined as data_source. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4054 svn path=/trunk/; revision=30376
Diffstat (limited to 'epan/dissectors/packet-per.c')
-rw-r--r--epan/dissectors/packet-per.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c
index 51a11d1c4c..417e0cb8dd 100644
--- a/epan/dissectors/packet-per.c
+++ b/epan/dissectors/packet-per.c
@@ -134,7 +134,7 @@ static tvbuff_t *new_octet_aligned_subset(tvbuff_t *tvb, guint32 offset, asn1_ct
if (offset & 0x07) { /* unaligned */
shift1 = offset & 0x07;
shift0 = 8 - shift1;
- buf = ep_alloc(actual_length);
+ buf = g_malloc(actual_length);
octet0 = tvb_get_guint8(tvb, boffset);
for (i=0; i<actual_length; i++) {
octet1 = octet0;
@@ -142,6 +142,7 @@ static tvbuff_t *new_octet_aligned_subset(tvbuff_t *tvb, guint32 offset, asn1_ct
buf[i] = (octet1 << shift1) | (octet0 >> shift0);
}
sub_tvb = tvb_new_child_real_data(tvb, buf, actual_length, length);
+ tvb_set_free_cb(sub_tvb, g_free);
add_new_data_source(actx->pinfo, sub_tvb, "Unaligned OCTET STRING");
} else { /* aligned */
sub_tvb = tvb_new_subset(tvb, boffset, actual_length, length);
@@ -195,7 +196,7 @@ tvbuff_t *new_octet_aligned_subset_bits(tvbuff_t *tvb, guint32 offset, asn1_ctx_
/* Number of bits = even number of octets */
return new_octet_aligned_subset(tvb, offset, actx, length);
}
- buf = ep_alloc(length);
+ buf = g_malloc(length);
if (actx->aligned)
{
@@ -244,6 +245,7 @@ tvbuff_t *new_octet_aligned_subset_bits(tvbuff_t *tvb, guint32 offset, asn1_ctx_
buf[i] = (guint8) (word & 0x00ff);
}
sub_tvb = tvb_new_child_real_data(tvb, buf, length, length);
+ tvb_set_free_cb(sub_tvb, g_free);
add_new_data_source(actx->pinfo, sub_tvb, "Unaligned OCTET STRING");
return sub_tvb;