diff options
author | Guy Harris <gharris@sonic.net> | 2021-04-16 00:38:13 -0700 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-04-16 08:34:54 +0000 |
commit | 512adcb0463bcf4ca33ee974afb811e6079e5a50 (patch) | |
tree | c02ba4ff1ae95e1482fa46289f6f8ca9600c4b26 | |
parent | 80cfcd8227971de24187e8ae550cf7ffb4a54b08 (diff) |
ptvcursor: just do a realloc.
ptvcursor_new_subtree_levels() just needs to do a wmem_realloc() on the
subtree array; that will take care of ensuring the old data is in the
new array.
-rw-r--r-- | epan/proto.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/epan/proto.c b/epan/proto.c index 683bafbd40..2a156b8d84 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -1113,15 +1113,12 @@ static void ptvcursor_new_subtree_levels(ptvcursor_t *ptvc) { subtree_lvl *pushed_tree; - size_t pushed_tree_len = sizeof(subtree_lvl) * ptvc->pushed_tree_max; DISSECTOR_ASSERT(ptvc->pushed_tree_max <= SUBTREE_MAX_LEVELS-SUBTREE_ONCE_ALLOCATION_NUMBER); ptvc->pushed_tree_max += SUBTREE_ONCE_ALLOCATION_NUMBER; - pushed_tree = (subtree_lvl *)wmem_alloc(wmem_packet_scope(), sizeof(subtree_lvl) * ptvc->pushed_tree_max); + pushed_tree = (subtree_lvl *)wmem_realloc(wmem_packet_scope(), (void *)ptvc->pushed_tree, sizeof(subtree_lvl) * ptvc->pushed_tree_max); DISSECTOR_ASSERT(pushed_tree != NULL); - if (ptvc->pushed_tree) - memcpy(pushed_tree, ptvc->pushed_tree, pushed_tree_len); ptvc->pushed_tree = pushed_tree; } |