]> sigrok.org Git - pulseview.git/commitdiff
LogicSegment: Don't use new/delete in get_unpacked_sample()
authorSoeren Apel <redacted>
Wed, 3 Jan 2018 23:30:28 +0000 (00:30 +0100)
committerUwe Hermann <redacted>
Tue, 9 Jan 2018 23:34:39 +0000 (00:34 +0100)
pv/data/logicsegment.cpp

index 62f188e383d4dff662874dce86d975f0ecbdf3a9..38f4bf246c21a619e531be955af26075678c2569 100644 (file)
@@ -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;
 }