aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-08-31 21:59:53 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2017-08-31 21:34:50 +0000
commitb7a9c02a50cc6fe5562204d09cb66e556d2f6ce9 (patch)
treec270b82ee96efc60f99c66920064b3fb0358a49a /epan/dissectors/asn1
parentb974952b4cdb954e9b7fe4dda56d8ffec584f323 (diff)
H248: check that exported_pdu tap is listening before tapping packets
It prevents a memory leak Bug: 14025 Change-Id: Ica4dd81aad38046a858988e8b30e3d7e40d0d721 Reviewed-on: https://code.wireshark.org/review/23336 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/asn1')
-rw-r--r--epan/dissectors/asn1/h248/packet-h248-template.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/asn1/h248/packet-h248-template.c b/epan/dissectors/asn1/h248/packet-h248-template.c
index 0111c446e6..f5f5fcf253 100644
--- a/epan/dissectors/asn1/h248/packet-h248-template.c
+++ b/epan/dissectors/asn1/h248/packet-h248-template.c
@@ -1434,14 +1434,15 @@ static guint8 wild_card = 0xFF; /* place to store wildcardField */
static void
export_h248_pdu(packet_info *pinfo, tvbuff_t *tvb)
{
- exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "h248", EXP_PDU_TAG_PROTO_NAME);
+ if (have_tap_listener(exported_pdu_tap)) {
+ exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "h248", EXP_PDU_TAG_PROTO_NAME);
- exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
- exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
- exp_pdu_data->pdu_tvb = tvb;
-
- tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
+ exp_pdu_data->pdu_tvb = tvb;
+ tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
+ }
}
extern void h248_param_ber_integer(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int hfid, h248_curr_info_t* u _U_, void* implicit) {