epan: Fix a memory leak.

Make sure _proto_tree_add_bits_ret_val allocates a bits array using the
packet scope, otherwise we leak memory. Fixes #17032.


(cherry picked from commit a9fc769d7b)
This commit is contained in:
Gerald Combs 2020-12-01 21:45:39 +00:00
parent 970e9bfb2c
commit 5edf715c04
1 changed files with 1 additions and 1 deletions

View File

@ -12169,7 +12169,7 @@ _proto_tree_add_bits_ret_val(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
break;
case FT_BYTES:
bytes = tvb_get_bits_array(NULL, tvb, bit_offset, no_of_bits, &bytes_length);
bytes = tvb_get_bits_array(wmem_packet_scope(), tvb, bit_offset, no_of_bits, &bytes_length);
pi = proto_tree_add_bytes_with_length(tree, hfindex, tvb, offset, length, bytes, (gint) bytes_length);
proto_item_fill_label(PITEM_FINFO(pi), lbl_str);
proto_item_set_text(pi, "%s", lbl_str);