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>
This commit is contained in:
Peter Wu 2018-09-29 19:01:24 +02:00 committed by Roland Knall
parent 62de3e6a44
commit 91030a16aa
1 changed files with 5 additions and 9 deletions

View File

@ -89,17 +89,13 @@ int FrameInformation::frameNum() const
const QByteArray FrameInformation::printableData()
{
QByteArray data;
if ( ! fi_ )
return QByteArray();
if ( fi_ )
{
int rem_length = tvb_captured_length(edt_.tvb);
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