aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-websocket.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2014-12-30 17:50:30 +0100
committerMartin Kaiser <wireshark@kaiser.cx>2014-12-30 17:04:09 +0000
commit246f727789b3739a911c0cb4e4f1f5904ba13f75 (patch)
treebc20a1baa24c868edba94e7c67305a88849c2494 /epan/dissectors/packet-websocket.c
parente05e8f8ab012e22e94f58413557564960529a0d7 (diff)
use packet-scoped memory for the unmasked data tvb
Change-Id: I5f9b769e26c16072a1656dfe9094487d6dfe76f4 Reviewed-on: https://code.wireshark.org/review/6142 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-websocket.c')
-rw-r--r--epan/dissectors/packet-websocket.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/epan/dissectors/packet-websocket.c b/epan/dissectors/packet-websocket.c
index 056b9b65b0..637d6a93f9 100644
--- a/epan/dissectors/packet-websocket.c
+++ b/epan/dissectors/packet-websocket.c
@@ -135,21 +135,18 @@ tvb_unmasked(tvbuff_t *tvb, const guint offset, guint payload_length, const guin
{
gchar *data_unmask;
- tvbuff_t *tvb_unmask = NULL;
guint i;
const guint8 *data_mask;
guint unmasked_length = payload_length > MAX_UNMASKED_LEN ? MAX_UNMASKED_LEN : payload_length;
- data_unmask = (gchar *)g_malloc(unmasked_length);
+ data_unmask = (gchar *)wmem_alloc(wmem_packet_scope(), unmasked_length);
data_mask = tvb_get_ptr(tvb, offset, unmasked_length);
/* Unmasked(XOR) Data... */
for(i=0; i < unmasked_length; i++) {
data_unmask[i] = data_mask[i] ^ masking_key[i%4];
}
- tvb_unmask = tvb_new_real_data(data_unmask, unmasked_length, payload_length);
- tvb_set_free_cb(tvb_unmask, g_free);
- return tvb_unmask;
+ return tvb_new_real_data(data_unmask, unmasked_length, payload_length);
}
static int