aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-armagetronad.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-armagetronad.c')
-rw-r--r--epan/dissectors/packet-armagetronad.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/dissectors/packet-armagetronad.c b/epan/dissectors/packet-armagetronad.c
index 194e618723..a09dfa5f16 100644
--- a/epan/dissectors/packet-armagetronad.c
+++ b/epan/dissectors/packet-armagetronad.c
@@ -30,6 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
/* Initialize the protocol and registered fields */
static int proto_armagetronad = -1;
@@ -142,8 +143,9 @@ add_message_data(tvbuff_t * tvb, gint offset, guint16 data_len,
{
guint16 *data = NULL;
- if (tree)
- data = (guint16 *) tvb_memdup(tvb, offset, data_len);
+ if (tree) {
+ data = (guint16*)tvb_memcpy(tvb, ep_alloc(data_len), offset, data_len);
+ }
if (data) {
guint16 *ptr, *end = &data[data_len / 2];
@@ -167,7 +169,6 @@ add_message_data(tvbuff_t * tvb, gint offset, guint16 data_len,
proto_tree_add_string(tree, hf_armagetronad_data, tvb, offset,
data_len, (gchar *) data);
- g_free(data);
data = NULL;
} else
proto_tree_add_item(tree, hf_armagetronad_data, tvb, offset,