From: Soeren Apel Date: Wed, 3 Jan 2018 23:30:28 +0000 (+0100) Subject: LogicSegment: Don't use new/delete in get_unpacked_sample() X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4d08da71e288c7b7be6c0455c0bb6834d4b318fd;p=pulseview.git LogicSegment: Don't use new/delete in get_unpacked_sample() --- diff --git a/pv/data/logicsegment.cpp b/pv/data/logicsegment.cpp index 62f188e3..38f4bf24 100644 --- a/pv/data/logicsegment.cpp +++ b/pv/data/logicsegment.cpp @@ -296,10 +296,11 @@ uint64_t LogicSegment::get_unpacked_sample(uint64_t index) const { assert(index < sample_count_); - uint8_t* data = new uint8_t[unit_size_]; + assert(unit_size_ <= 8); // 8 * 8 = 64 channels + uint8_t data[8]; + get_raw_samples(index, 1, data); uint64_t sample = unpack_sample(data); - delete[] data; return sample; }