diff options
author | Anders Broman <anders.broman@ericsson.com> | 2010-01-11 16:14:26 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2010-01-11 16:14:26 +0000 |
commit | 324af9e6faea22dc42c13cf7efaeef7777550c2d (patch) | |
tree | 987fbd224c57a79a89dd00ab3969dc74c2e10bb8 /epan/dissectors/packet-dmp.c | |
parent | 11ef8a5e0f0acf7134edf8c0b4bb1d7239994d11 (diff) |
Fix part of Bug 3917 "tvb_new_real_data is prone to memory leak"
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3917
svn path=/trunk/; revision=31499
Diffstat (limited to 'epan/dissectors/packet-dmp.c')
-rw-r--r-- | epan/dissectors/packet-dmp.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index cd2edf3570..df2e61cf71 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -2744,22 +2744,22 @@ static gint dissect_dmp_message (tvbuff_t *tvb, packet_info *pinfo, } else if (len > 0 && (dmp.body_format == FREE_TEXT || dmp.body_format == FREE_TEXT_SUBJECT)) { if (compr_alg == ALGORITHM_ZLIB) { - if ((next_tvb = tvb_uncompress (tvb, offset, len)) != NULL) { - gint zlen = tvb_length (next_tvb); - add_new_data_source (pinfo, next_tvb, "Uncompressed User data"); - tf = proto_tree_add_none_format (message_tree, - hf_message_body_uncompr, - next_tvb, 0, zlen, - "Uncompressed User data, " - "Length: %d", zlen); - field_tree = proto_item_add_subtree (tf, ett_message_body_uncompr); - proto_tree_add_item (field_tree, hf_message_body_uncompressed, - next_tvb, 0, -1, FALSE); + if ((next_tvb = tvb_child_uncompress (NULL, tvb, offset, len)) != NULL) { + gint zlen = tvb_length (next_tvb); + add_new_data_source (pinfo, next_tvb, "Uncompressed User data"); + tf = proto_tree_add_none_format (message_tree, + hf_message_body_uncompr, + next_tvb, 0, zlen, + "Uncompressed User data, " + "Length: %d", zlen); + field_tree = proto_item_add_subtree (tf, ett_message_body_uncompr); + proto_tree_add_item (field_tree, hf_message_body_uncompressed, + next_tvb, 0, -1, FALSE); } else { - tf = proto_tree_add_text (message_tree, tvb, offset, -1, - "Error: Unable to uncompress content"); - expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, - "Unable to uncompress content"); + tf = proto_tree_add_text (message_tree, tvb, offset, -1, + "Error: Unable to uncompress content"); + expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, + "Unable to uncompress content"); } } else if (eit != EIT_BILATERAL) { proto_tree_add_item (field_tree, hf_message_body_plain, tvb, |