]> sigrok.org Git - pulseview.git/commitdiff
Session: Fix mismatched delete operator.
authorPhilipp Marek <redacted>
Sat, 18 Nov 2017 12:53:24 +0000 (13:53 +0100)
committerPhilipp Marek <redacted>
Sat, 18 Nov 2017 12:53:44 +0000 (13:53 +0100)
Mismatched free() / delete / delete []
   at 0x4C2D31B: operator delete(void*) (vg_replace_malloc.c:576)
   by 0x1C76D0: operator() (unique_ptr.h:78)
   by 0x1C76D0: ~unique_ptr (unique_ptr.h:268)
   by 0x1C76D0: pv::data::AnalogSegment::append_interleaved_samples(float const*, unsigned long, unsigned long) (analogsegment.cpp:78)
...
Address 0x1d123f70 is 0 bytes inside a block of size 312 alloc'd
   at 0x4C2C97F: operator new[](unsigned long) (vg_replace_malloc.c:423)
   by 0x1C765E: pv::data::AnalogSegment::append_interleaved_samples(float const*, unsigned long, unsigned long) (analogsegment.cpp:78)
   by 0x1AFDD5: pv::Session::feed_in_analog(std::shared_ptr<sigrok::Analog>) (session.cpp:1142)

pv/data/analogsegment.cpp

index 0610a4a800ca426a961950491b1fa05fea920ba4..7a3d62d880ff912356f7daac4bf962af6d1611b5 100644 (file)
@@ -75,7 +75,7 @@ void AnalogSegment::append_interleaved_samples(const float *data,
        uint64_t prev_sample_count = sample_count_;
 
        // Deinterleave the samples and add them
-       unique_ptr<float> deint_data(new float[sample_count]);
+       unique_ptr<float[]> deint_data(new float[sample_count]);
        float *deint_data_ptr = deint_data.get();
        for (uint32_t i = 0; i < sample_count; i++) {
                *deint_data_ptr = (float)(*data);