diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-09-29 19:01:24 +0200 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2018-09-29 19:12:13 +0000 |
commit | 91030a16aaac8813ab1c5eb7580ef005e70bf5f9 (patch) | |
tree | b872bd06bfd4bf7e18159fd8e3b48458e00c0a61 | |
parent | 62de3e6a448b09365cd987686d418f316331792c (diff) |
Qt/FrameInformation: do not use file-scoped memory for temporary data
Let QByteArray own the memory instead of wmem to allow memory to be
released earlier.
Change-Id: Ibf6d1a56120d30daea76924b8006480854dcfbd3
Reviewed-on: https://code.wireshark.org/review/29923
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
-rw-r--r-- | ui/qt/utils/frame_information.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ui/qt/utils/frame_information.cpp b/ui/qt/utils/frame_information.cpp index 68acb67bdb..8f5650d746 100644 --- a/ui/qt/utils/frame_information.cpp +++ b/ui/qt/utils/frame_information.cpp @@ -89,17 +89,13 @@ int FrameInformation::frameNum() const const QByteArray FrameInformation::printableData() { - QByteArray data; - - if ( fi_ ) - { - int rem_length = tvb_captured_length(edt_.tvb); + if ( ! fi_ ) + return QByteArray(); - uint8_t * dataSet = (uint8_t *)tvb_memdup(wmem_file_scope(), edt_.tvb, 0, rem_length ); - data = QByteArray::fromRawData((char *)dataSet, rem_length); - } - return data; + int length = tvb_captured_length(edt_.tvb); + const char *data = (const char *)tvb_get_ptr(edt_.tvb, 0, length); + return QByteArray(data, length); } /* * Editor modelines |