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.
This commit is contained in:
Gerald Combs 2020-12-01 13:45:39 -08:00 committed by AndersBroman
parent 79f84f7737
commit a9fc769d7b
1 changed files with 1 additions and 1 deletions

View File

@ -12299,7 +12299,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);