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-megaco.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-megaco.c')
-rw-r--r-- | epan/dissectors/packet-megaco.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index a3c44d829a..9a4c1ee6ae 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -48,7 +48,7 @@ #include <glib.h> #include <epan/packet.h> -#include <epan/emem.h> +#include <epan/wmem/wmem.h> #include <epan/addr_resolv.h> #include <epan/prefs.h> #include <epan/strutil.h> @@ -1244,7 +1244,7 @@ nextcontext: if ( (tempchar >= 'a')&& (tempchar <= 'z')) tempchar = tempchar - 0x20; - term = ep_new0(gcp_term_t); + term = wmem_new0(wmem_packet_scope(), gcp_term_t); wild_term = GCP_WILDCARD_NONE; term->type = GCP_TERM_TYPE_UNKNOWN; @@ -1754,7 +1754,7 @@ dissect_megaco_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *megaco_tree, if(len<20480){ int i; tvbuff_t *h245_tvb; - guint8 *buf = (guint8 *)g_malloc(10240); + guint8 *buf = (guint8 *)wmem_alloc(pinfo->pool, 10240); /* first, skip to where the encoded pdu starts, this is the first hex digit after the '=' char. @@ -1814,7 +1814,6 @@ dissect_megaco_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *megaco_tree, return; } h245_tvb = tvb_new_child_real_data(tvb, buf,i,i); - tvb_set_free_cb(h245_tvb, g_free); add_new_data_source(pinfo, h245_tvb, "H.245 over MEGACO"); /* should go through a handle, however, the two h245 entry points are different, one is over tpkt and the other is raw @@ -1833,7 +1832,7 @@ dissect_megaco_h324_h223caprn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *meg if(len<20480){ int i; tvbuff_t *h245_tvb; - guint8 *buf = (guint8 *)g_malloc(10240); + guint8 *buf = (guint8 *)wmem_alloc(pinfo->pool, 10240); /* first, skip to where the encoded pdu starts, this is the first hex digit after the '=' char. @@ -1894,7 +1893,6 @@ dissect_megaco_h324_h223caprn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *meg } h245_tvb = tvb_new_child_real_data(tvb, buf,i,i); add_new_data_source(pinfo, h245_tvb, "H.245 over MEGACO"); - tvb_set_free_cb(h245_tvb, g_free); /* should go through a handle, however, the two h245 entry points are different, one is over tpkt and the other is raw */ |