diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2013-08-19 14:55:41 +0000 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2013-08-19 14:55:41 +0000 |
commit | b46f9bebe29e215e0b84242771a92f1bbe6fdb38 (patch) | |
tree | 45c8664141827cb3018c2c7b2407fb906e4dad53 /epan/dissectors/packet-dnp.c | |
parent | 02cae558f997dba1fd17011cc84e317f17d17a4d (diff) |
Change some dissectors to use pinfo memory pool instead of malloc if it can trigger an exception between between buffer allocation and tvb_set_free_cb call
svn path=/trunk/; revision=51427
Diffstat (limited to 'epan/dissectors/packet-dnp.c')
-rw-r--r-- | epan/dissectors/packet-dnp.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 421f6fe2c9..ec668445c3 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -2973,7 +2973,7 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* XXX - check for dl_len <= 5 */ data_len = dl_len - 5; - tmp = (guint8 *)g_malloc(data_len); + tmp = (guint8 *)wmem_alloc(pinfo->pool, data_len); tmp_ptr = tmp; i = 0; data_offset = 1; /* skip the transport layer byte when assembling chunks */ @@ -3017,7 +3017,6 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gboolean save_fragmented; al_tvb = tvb_new_child_real_data(tvb, tmp, (guint) (tmp_ptr-tmp), (gint) (tmp_ptr-tmp)); - tvb_set_free_cb(al_tvb, g_free); /* Check for fragmented packet */ save_fragmented = pinfo->fragmented; @@ -3103,7 +3102,6 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* CRC error - throw away the data. */ next_tvb = NULL; - g_free(tmp); proto_tree_add_text(dnp3_tree, tvb, 11, -1, "CRC failed, %u chunks", i); } |