aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-04-21 19:12:26 +0200
committerAnders Broman <a.broman58@gmail.com>2016-04-22 04:32:32 +0000
commit9abbf8b69d830bff29705991d6ebb760ec2f4454 (patch)
tree7a75eda3bf85ae8846511215c4c0ef0a42ca1940
parent9de18e88f501ef953395b8cadf9dbc9b79ce40cc (diff)
Do not mix wmem and glib allocators
Change-Id: I0e845668a1b9dbec93ea920a8585ecfe60f001d1 Reviewed-on: https://code.wireshark.org/review/15044 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/asn1/c1222/packet-c1222-template.c2
-rw-r--r--epan/dissectors/packet-bmc.c3
-rw-r--r--epan/dissectors/packet-btavctp.c2
-rw-r--r--epan/dissectors/packet-btavrcp.c2
-rw-r--r--epan/dissectors/packet-c1222.c2
-rw-r--r--epan/dissectors/packet-data.c3
-rw-r--r--epan/dissectors/packet-dcerpc-netlogon.c3
-rw-r--r--epan/dissectors/packet-dcerpc.c4
-rw-r--r--epan/dissectors/packet-ieee802154.c3
-rw-r--r--epan/dissectors/packet-lapsat.c3
-rw-r--r--epan/dissectors/packet-lbmc.c4
-rw-r--r--epan/dissectors/packet-ldss.c4
-rw-r--r--epan/dissectors/packet-lwm.c3
-rw-r--r--epan/dissectors/packet-nfs.c7
-rw-r--r--epan/dissectors/packet-ntlmssp.c11
-rw-r--r--epan/dissectors/packet-ppp.c3
-rw-r--r--epan/dissectors/packet-smb2.c11
-rw-r--r--epan/dissectors/packet-tacacs.c6
-rw-r--r--epan/tvbuff_composite.c8
-rw-r--r--epan/tvbuff_zlib.c3
20 files changed, 37 insertions, 50 deletions
diff --git a/epan/dissectors/asn1/c1222/packet-c1222-template.c b/epan/dissectors/asn1/c1222/packet-c1222-template.c
index 42f0ab8a40..c10244893e 100644
--- a/epan/dissectors/asn1/c1222/packet-c1222-template.c
+++ b/epan/dissectors/asn1/c1222/packet-c1222-template.c
@@ -950,7 +950,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_
encrypted = TRUE;
#ifdef HAVE_LIBGCRYPT
if (c1222_decrypt) {
- buffer = (guchar *)tvb_memdup(wmem_packet_scope(), tvb, offset, len2);
+ buffer = (guchar *)tvb_memdup(pinfo->pool, tvb, offset, len2);
if (!decrypt_packet(buffer, len2, TRUE)) {
crypto_bad = TRUE;
} else {
diff --git a/epan/dissectors/packet-bmc.c b/epan/dissectors/packet-bmc.c
index 821bbed094..da3f62594f 100644
--- a/epan/dissectors/packet-bmc.c
+++ b/epan/dissectors/packet-bmc.c
@@ -99,12 +99,11 @@ dissect_bmc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* Needs bit-reversing. Create a new buffer, copy the message to it and bit-reverse */
len = tvb_reported_length(tvb);
- reversing_buffer = (guint8 *)tvb_memdup(NULL, tvb, offset, len);
+ reversing_buffer = (guint8 *)tvb_memdup(pinfo->pool, tvb, offset, len);
bitswap_buf_inplace(reversing_buffer, len);
/* Make this new buffer part of the display and provide a way to dispose of it */
bit_reversed_tvb = tvb_new_child_real_data(tvb, reversing_buffer, len, len);
- tvb_set_free_cb(bit_reversed_tvb, g_free);
add_new_data_source(pinfo, bit_reversed_tvb, "Bit-reversed Data");
message_type = tvb_get_guint8(bit_reversed_tvb, offset);
diff --git a/epan/dissectors/packet-btavctp.c b/epan/dissectors/packet-btavctp.c
index 225adfd28b..52f8701a28 100644
--- a/epan/dissectors/packet-btavctp.c
+++ b/epan/dissectors/packet-btavctp.c
@@ -383,7 +383,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
length += fragment->length;
}
- reassembled = (guint8 *) wmem_alloc(wmem_file_scope(), length);
+ reassembled = (guint8 *) wmem_alloc(pinfo->pool, length);
for (i_frame = 1; i_frame <= fragments->count; ++i_frame) {
fragment = (fragment_t *)wmem_tree_lookup32_le(fragments->fragment, i_frame);
diff --git a/epan/dissectors/packet-btavrcp.c b/epan/dissectors/packet-btavrcp.c
index 6afa800e57..49e2194503 100644
--- a/epan/dissectors/packet-btavrcp.c
+++ b/epan/dissectors/packet-btavrcp.c
@@ -1207,7 +1207,7 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
length += data_fragment->length;
}
- reassembled = (guint8 *) wmem_alloc(wmem_file_scope(), length);
+ reassembled = (guint8 *) wmem_alloc(pinfo->pool, length);
for (i_frame = 1; i_frame <= fragment->count; ++i_frame) {
data_fragment = (data_fragment_t *)wmem_tree_lookup32_le(fragment->fragments, i_frame);
diff --git a/epan/dissectors/packet-c1222.c b/epan/dissectors/packet-c1222.c
index 9dda73cdd2..1971ca940d 100644
--- a/epan/dissectors/packet-c1222.c
+++ b/epan/dissectors/packet-c1222.c
@@ -1001,7 +1001,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_
encrypted = TRUE;
#ifdef HAVE_LIBGCRYPT
if (c1222_decrypt) {
- buffer = (guchar *)tvb_memdup(wmem_packet_scope(), tvb, offset, len2);
+ buffer = (guchar *)tvb_memdup(pinfo->pool, tvb, offset, len2);
if (!decrypt_packet(buffer, len2, TRUE)) {
crypto_bad = TRUE;
} else {
diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c
index 9c84336ecb..30247fdc38 100644
--- a/epan/dissectors/packet-data.c
+++ b/epan/dissectors/packet-data.c
@@ -70,9 +70,8 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
proto_item *ti;
proto_tree *data_tree;
if (new_pane) {
- guint8 *real_data = (guint8 *)tvb_memdup(NULL, tvb, 0, bytes);
+ guint8 *real_data = (guint8 *)tvb_memdup(pinfo->pool, tvb, 0, bytes);
data_tvb = tvb_new_child_real_data(tvb,real_data,bytes,bytes);
- tvb_set_free_cb(data_tvb, g_free);
add_new_data_source(pinfo, data_tvb, "Not dissected data bytes");
} else {
data_tvb = tvb;
diff --git a/epan/dissectors/packet-dcerpc-netlogon.c b/epan/dissectors/packet-dcerpc-netlogon.c
index f835c61a1d..7a81074e02 100644
--- a/epan/dissectors/packet-dcerpc-netlogon.c
+++ b/epan/dissectors/packet-dcerpc-netlogon.c
@@ -7715,11 +7715,10 @@ dissect_packet_data(tvbuff_t *tvb ,tvbuff_t *auth_tvb _U_,
}
crypt_rc4_init(&rc4state,vars->encryption_key,16);
crypt_rc4(&rc4state,(guint8*)&copyconfounder,8);
- decrypted = (guint8*)tvb_memdup(NULL, tvb, offset,data_len);
+ decrypted = (guint8*)tvb_memdup(pinfo->pool, tvb, offset,data_len);
crypt_rc4_init(&rc4state,vars->encryption_key,16);
crypt_rc4(&rc4state,decrypted,data_len);
buf = tvb_new_child_real_data(tvb, decrypted, data_len, data_len);
- tvb_set_free_cb(buf, g_free);
/* Note: caller does add_new_data_source(...) */
}
else {
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index 9a1447e7b0..6b3eccb5ae 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -5003,7 +5003,7 @@ dissect_dcerpc_cn_rts(tvbuff_t *tvb, gint offset, packet_info *pinfo,
const guint32 conformance_count = dcerpc_tvb_get_ntohl(tvb, offset, hdr->drep);
proto_tree_add_uint(cn_rts_command_tree, hf_dcerpc_cn_rts_command_conformancecount, tvb, offset, 4, conformance_count);
offset += 4;
- padding = (guint8 *)tvb_memdup(NULL, tvb, offset, conformance_count);
+ padding = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, offset, conformance_count);
proto_tree_add_bytes(cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, conformance_count, padding);
offset += conformance_count;
} break;
@@ -5029,7 +5029,7 @@ dissect_dcerpc_cn_rts(tvbuff_t *tvb, gint offset, packet_info *pinfo,
offset += 16;
} break;
}
- padding = (guint8 *)tvb_memdup(NULL, tvb, offset, 12);
+ padding = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, offset, 12);
proto_tree_add_bytes(cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, 12, padding);
offset += 12;
} break;
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 3039e27a7f..357f63a195 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -2545,7 +2545,7 @@ dissect_ieee802154_decrypt(tvbuff_t *tvb, guint offset, packet_info *pinfo, ieee
* We will decrypt the message in-place and then use the buffer as the
* real data for the new tvb.
*/
- text = (guint8 *)tvb_memdup(NULL, tvb, offset, captured_len);
+ text = (guint8 *)tvb_memdup(pinfo->pool, tvb, offset, captured_len);
/* Perform CTR-mode transformation. */
if (!ccm_ctr_encrypt(key, tmp, rx_mic, text, captured_len)) {
@@ -2556,7 +2556,6 @@ dissect_ieee802154_decrypt(tvbuff_t *tvb, guint offset, packet_info *pinfo, ieee
/* Create a tvbuff for the plaintext. */
ptext_tvb = tvb_new_child_real_data(tvb, text, captured_len, reported_len);
- tvb_set_free_cb(ptext_tvb, g_free);
add_new_data_source(pinfo, ptext_tvb, "Decrypted IEEE 802.15.4 payload");
*status = DECRYPT_PACKET_SUCCEEDED;
}
diff --git a/epan/dissectors/packet-lapsat.c b/epan/dissectors/packet-lapsat.c
index 108f414f73..f7087f1840 100644
--- a/epan/dissectors/packet-lapsat.c
+++ b/epan/dissectors/packet-lapsat.c
@@ -507,10 +507,9 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissec
if ((plen + hlen) == tvb_captured_length(tvb)) {
/* Need to integrate the last nibble */
- guint8 *data = (guint8 *)tvb_memdup(NULL, tvb, hlen, plen);
+ guint8 *data = (guint8 *)tvb_memdup(pinfo->pool, tvb, hlen, plen);
data[plen-1] |= tvb_get_guint8(tvb, 2) << 4;
payload = tvb_new_child_real_data(tvb, data, plen, plen);
- tvb_set_free_cb(payload, g_free);
} else {
/* Last nibble doesn't need merging */
payload = tvb_new_subset(tvb, hlen, plen, -1);
diff --git a/epan/dissectors/packet-lbmc.c b/epan/dissectors/packet-lbmc.c
index d3b303a777..b6db8ac1b2 100644
--- a/epan/dissectors/packet-lbmc.c
+++ b/epan/dissectors/packet-lbmc.c
@@ -9967,7 +9967,7 @@ static int dissect_nhdr_extopt(tvbuff_t * tvb, int offset, packet_info * pinfo,
{
tvb_memcpy(tvb, reassembly->data + fragment_offset, data_offset, data_len);
reassembly->len += data_len;
- buf = (gchar *) wmem_memdup(wmem_file_scope(), reassembly->data, reassembly->len);
+ buf = (gchar *) wmem_memdup(pinfo->pool, reassembly->data, reassembly->len);
reassembly_tvb = tvb_new_real_data(buf, reassembly->len, reassembly->len);
add_new_data_source(pinfo, reassembly_tvb, "Reassembled EXTOPT fragment data");
}
@@ -11367,7 +11367,7 @@ int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, pr
gchar * buf = NULL;
/* Create a new real data tvb of the reassembled data. */
- buf = (gchar *)wmem_alloc(wmem_file_scope(), (size_t)msg->total_len);
+ buf = (gchar *)wmem_alloc(pinfo->pool, (size_t)msg->total_len);
cur = msg->entry;
while (cur != NULL)
{
diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c
index e30354d40b..5a13ab8058 100644
--- a/epan/dissectors/packet-ldss.c
+++ b/epan/dissectors/packet-ldss.c
@@ -284,7 +284,7 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
digest_type = tvb_get_guint8 (tvb, 2);
compression = tvb_get_guint8 (tvb, 3);
cookie = tvb_get_ntohl (tvb, 4);
- digest = (guint8 *)tvb_memdup (NULL, tvb, 8, DIGEST_LEN);
+ digest = (guint8 *)tvb_memdup (wmem_file_scope(), tvb, 8, DIGEST_LEN);
size = tvb_get_ntoh64 (tvb, 40);
offset = tvb_get_ntoh64 (tvb, 48);
targetTime = tvb_get_ntohl (tvb, 56);
@@ -520,7 +520,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
/* Include new-line in line */
- line = (guint8 *)tvb_memdup(NULL, tvb, offset, linelen+1); /* XXX - memory leak? */
+ line = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, offset, linelen+1); /* XXX - memory leak? */
line_tree = proto_tree_add_subtree(ldss_tree, tvb, offset, linelen,
ett_ldss_transfer_req, NULL,
diff --git a/epan/dissectors/packet-lwm.c b/epan/dissectors/packet-lwm.c
index 220a6c31a8..1bbc38c3de 100644
--- a/epan/dissectors/packet-lwm.c
+++ b/epan/dissectors/packet-lwm.c
@@ -429,7 +429,7 @@ static int dissect_lwm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
payload_length=tvb_reported_length(new_tvb) - LWM_MIC_LEN;
/* ECB - Nwk security vector*/
- text = (guint8 *)tvb_memdup(NULL, new_tvb, 0, payload_length);
+ text = (guint8 *)tvb_memdup(pinfo->pool, new_tvb, 0, payload_length);
payload_offset=0;
/*Decrypt the actual data */
@@ -478,7 +478,6 @@ static int dissect_lwm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
decrypted_tvb = tvb_new_real_data(text,length, length);
call_data_dissector(decrypted_tvb, pinfo, lwm_tree);
/* XXX - needed?
- tvb_set_free_cb(decrypted_tvb, g_free);
add_new_data_source(pinfo, decrypted_tvb, "Decrypted LWmesh Payload"); */
col_append_fstr(pinfo->cinfo, COL_INFO, ", MIC SUCCESS");
diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c
index aed1ccf1c2..679c06d9d8 100644
--- a/epan/dissectors/packet-nfs.c
+++ b/epan/dissectors/packet-nfs.c
@@ -1039,8 +1039,8 @@ nfs_name_snoop_value_destroy(gpointer value)
g_free((gpointer)nns->name);
g_free((gpointer)nns->full_name);
- g_free((gpointer)nns->parent);
- g_free((gpointer)nns->fh);
+ wmem_free(NULL, nns->parent);
+ wmem_free(NULL, nns->fh);
g_free(nns);
}
@@ -1257,7 +1257,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of
fhlen = fh_length;
/* align it */
- fhdata = (guint32 *)tvb_memdup(NULL, tvb, fh_offset, fh_length);
+ fhdata = (guint32 *)tvb_memdup(wmem_packet_scope(), tvb, fh_offset, fh_length);
fhkey[0].length = 1;
fhkey[0].key = &fhlen;
fhkey[1].length = fhlen/4;
@@ -1265,7 +1265,6 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of
fhkey[2].length = 0;
nns = (nfs_name_snoop_t *)wmem_tree_lookup32_array(nfs_name_snoop_known, &fhkey[0]);
- g_free(fhdata);
}
/* if we know the mapping, print the filename */
diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c
index aa24bf73e9..5ce7f3d63d 100644
--- a/epan/dissectors/packet-ntlmssp.c
+++ b/epan/dissectors/packet-ntlmssp.c
@@ -2047,7 +2047,7 @@ decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
/* Store the decrypted contents in the packet state struct
(of course at this point, they aren't decrypted yet) */
- packet_ntlmssp_info->decrypted_payload = (guint8 *)tvb_memdup(NULL, tvb, offset,
+ packet_ntlmssp_info->decrypted_payload = (guint8 *)tvb_memdup(wmem_file_scope(), tvb, offset,
encrypted_block_length);
packet_ntlmssp_info->payload_len = encrypted_block_length;
decrypted_payloads = g_slist_prepend(decrypted_payloads,
@@ -2541,7 +2541,7 @@ dissect_ntlmssp_encrypted_payload(tvbuff_t *data_tvb,
/* Store the decrypted contents in the packet state struct
(of course at this point, they aren't decrypted yet) */
- packet_ntlmssp_info->decrypted_payload = tvb_memdup(NULL, data_tvb, offset,
+ packet_ntlmssp_info->decrypted_payload = tvb_memdup(wmem_file_scope(), data_tvb, offset,
encrypted_block_length);
decrypted_payloads = g_slist_prepend(decrypted_payloads,
packet_ntlmssp_info->decrypted_payload);
@@ -2569,12 +2569,6 @@ dissect_ntlmssp_encrypted_payload(tvbuff_t *data_tvb,
}
#endif
-static void
-free_payload(gpointer decrypted_payload, gpointer user_data _U_)
-{
- g_free(decrypted_payload);
-}
-
static guint
header_hash(gconstpointer pointer)
{
@@ -2604,7 +2598,6 @@ static void
ntlmssp_cleanup_protocol(void)
{
if (decrypted_payloads != NULL) {
- g_slist_foreach(decrypted_payloads, free_payload, NULL);
g_slist_free(decrypted_payloads);
decrypted_payloads = NULL;
}
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index e9f5b864b3..7a38f177ff 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -4953,7 +4953,7 @@ dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
tvb_ensure_bytes_exist (tvb, 0, hdr_len); /* ip_hdr_len + 8 */
/* allocate a copy of the IP packet */
- ip_packet = (guchar *)tvb_memdup(NULL, tvb, 0, length);
+ ip_packet = (guchar *)tvb_memdup(pinfo->pool, tvb, 0, length);
/* restore the proper values to the IP and UDP length fields */
ip_packet[2] = length >> 8;
@@ -4964,7 +4964,6 @@ dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
next_tvb = tvb_new_child_real_data(tvb, ip_packet, length, length);
add_new_data_source(pinfo, next_tvb, "Decompressed Data");
- tvb_set_free_cb(next_tvb, g_free);
if (!dissector_try_uint(ppp_subdissector_table, PPP_IP, next_tvb, pinfo,
info_tree)) {
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index a2dbc2a1bb..7e2f48b9f3 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -7710,11 +7710,11 @@ dissect_smb2_transform_header(packet_info *pinfo _U_, proto_tree *tree,
memcpy(&A_1[1], sti->nonce, 15 - 4);
- plain_data = (guint8 *)tvb_memdup(NULL, tvb, offset, sti->size);
+ plain_data = (guint8 *)tvb_memdup(pinfo->pool, tvb, offset, sti->size);
/* Open the cipher. */
if (gcry_cipher_open(&cipher_hd, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR, 0)) {
- g_free(plain_data);
+ wmem_free(pinfo->pool, plain_data);
plain_data = NULL;
goto done_decryption;
}
@@ -7722,20 +7722,20 @@ dissect_smb2_transform_header(packet_info *pinfo _U_, proto_tree *tree,
/* Set the key and initial value. */
if (gcry_cipher_setkey(cipher_hd, decryption_key, 16)) {
gcry_cipher_close(cipher_hd);
- g_free(plain_data);
+ wmem_free(pinfo->pool, plain_data);
plain_data = NULL;
goto done_decryption;
}
if (gcry_cipher_setctr(cipher_hd, A_1, 16)) {
gcry_cipher_close(cipher_hd);
- g_free(plain_data);
+ wmem_free(pinfo->pool, plain_data);
plain_data = NULL;
goto done_decryption;
}
if (gcry_cipher_encrypt(cipher_hd, plain_data, sti->size, NULL, 0)) {
gcry_cipher_close(cipher_hd);
- g_free(plain_data);
+ wmem_free(pinfo->pool, plain_data);
plain_data = NULL;
goto done_decryption;
}
@@ -7749,7 +7749,6 @@ done_decryption:
if (plain_data != NULL) {
*plain_tvb = tvb_new_child_real_data(*enc_tvb, plain_data, sti->size, sti->size);
- tvb_set_free_cb(*plain_tvb, g_free);
add_new_data_source(pinfo, *plain_tvb, "Decrypted SMB3");
}
diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c
index a2b461745f..5054f90126 100644
--- a/epan/dissectors/packet-tacacs.c
+++ b/epan/dissectors/packet-tacacs.c
@@ -381,7 +381,7 @@ tacplus_decrypted_tvb_setup( tvbuff_t *tvb, tvbuff_t **dst_tvb, packet_info *pin
tvb_memcpy(tvb, session_id, 4,4);
- buff = (guint8 *)tvb_memdup(NULL, tvb, TAC_PLUS_HDR_SIZE, len);
+ buff = (guint8 *)tvb_memdup(pinfo->pool, tvb, TAC_PLUS_HDR_SIZE, len);
md5_xor( buff, key, len, session_id,version, tvb_get_guint8(tvb,2) );
@@ -389,10 +389,6 @@ tacplus_decrypted_tvb_setup( tvbuff_t *tvb, tvbuff_t **dst_tvb, packet_info *pin
/* Allocate a new tvbuff, referring to the decrypted data. */
*dst_tvb = tvb_new_child_real_data(tvb, buff, len, len );
- /* Arrange that the allocated packet data copy be freed when the
- tvbuff is freed. */
- tvb_set_free_cb( *dst_tvb, g_free );
-
/* Add the decrypted data to the data source list. */
add_new_data_source(pinfo, *dst_tvb, "TACACS+ Decrypted");
diff --git a/epan/tvbuff_composite.c b/epan/tvbuff_composite.c
index 6d9d98557b..15bf96b2c0 100644
--- a/epan/tvbuff_composite.c
+++ b/epan/tvbuff_composite.c
@@ -112,7 +112,13 @@ composite_get_ptr(tvbuff_t *tvb, guint abs_offset, guint abs_length)
return tvb_get_ptr(member_tvb, member_offset, abs_length);
}
else {
- tvb->real_data = (guint8 *)tvb_memdup(NULL, tvb, 0, -1);
+ abs_offset = 0;
+ abs_length = 0;
+
+ tvb_check_offset_length(tvb, 0, -1, &abs_offset, &abs_length);
+
+ tvb->real_data = (guint8 *)g_malloc(abs_length);
+ tvb_memcpy(tvb, (void *)tvb->real_data, 0, abs_length);
return tvb->real_data + abs_offset;
}
diff --git a/epan/tvbuff_zlib.c b/epan/tvbuff_zlib.c
index 045b45faa8..3f23f57d58 100644
--- a/epan/tvbuff_zlib.c
+++ b/epan/tvbuff_zlib.c
@@ -68,7 +68,8 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
return NULL;
}
- compr = (guint8 *)tvb_memdup(NULL, tvb, offset, comprlen);
+ compr = (guint8 *)g_malloc(comprlen);
+ tvb_memcpy(tvb, compr, offset, comprlen);
if (!compr)
return NULL;