From: Soeren Apel Date: Tue, 5 Jun 2018 14:57:31 +0000 (+0200) Subject: Fix #1166 by using the correct array size X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3e617752af3aec93b05b8bc019b15bd46d598b34;p=pulseview.git Fix #1166 by using the correct array size --- diff --git a/pv/session.cpp b/pv/session.cpp index 797a461b..5356433f 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -1215,11 +1215,9 @@ void Session::feed_in_analog(shared_ptr analog) lock_guard lock(data_mutex_); const vector> channels = analog->channels(); - const unsigned int channel_count = channels.size(); - const size_t sample_count = analog->num_samples() / channel_count; bool sweep_beginning = false; - unique_ptr data(new float[analog->num_samples()]); + unique_ptr data(new float[analog->num_samples() * channels.size()]); analog->get_data_as_float(data.get()); if (signalbases_.empty()) @@ -1261,8 +1259,8 @@ void Session::feed_in_analog(shared_ptr analog) 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) {