]> sigrok.org Git - pulseview.git/commitdiff
Fix #1166 by using the correct array size
authorSoeren Apel <redacted>
Tue, 5 Jun 2018 14:57:31 +0000 (16:57 +0200)
committerUwe Hermann <redacted>
Tue, 5 Jun 2018 23:10:32 +0000 (01:10 +0200)
pv/session.cpp

index 797a461bf2d6ffbec1cb3deab085df21abfdb283..5356433f9027e8fa5298db01dff5256d8a28a674 100644 (file)
@@ -1215,11 +1215,9 @@ void Session::feed_in_analog(shared_ptr<Analog> analog)
        lock_guard<recursive_mutex> lock(data_mutex_);
 
        const vector<shared_ptr<Channel>> channels = analog->channels();
        lock_guard<recursive_mutex> lock(data_mutex_);
 
        const vector<shared_ptr<Channel>> channels = analog->channels();
-       const unsigned int channel_count = channels.size();
-       const size_t sample_count = analog->num_samples() / channel_count;
        bool sweep_beginning = false;
 
        bool sweep_beginning = false;
 
-       unique_ptr<float[]> data(new float[analog->num_samples()]);
+       unique_ptr<float[]> data(new float[analog->num_samples() * channels.size()]);
        analog->get_data_as_float(data.get());
 
        if (signalbases_.empty())
        analog->get_data_as_float(data.get());
 
        if (signalbases_.empty())
@@ -1261,8 +1259,8 @@ void Session::feed_in_analog(shared_ptr<Analog> analog)
                assert(segment);
 
                // Append the samples in the segment
                assert(segment);
 
                // Append the samples in the segment
-               segment->append_interleaved_samples(channel_data++, sample_count,
-                       channel_count);
+               segment->append_interleaved_samples(channel_data++, analog->num_samples(),
+                       channels.size());
        }
 
        if (sweep_beginning) {
        }
 
        if (sweep_beginning) {