diff --git a/src/import/ImportPCM.cpp b/src/import/ImportPCM.cpp index d8eef3273..d4f6eb0cb 100644 --- a/src/import/ImportPCM.cpp +++ b/src/import/ImportPCM.cpp @@ -451,17 +451,16 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory, if (maxBlock < 1) return ProgressResult::Failed; - SampleBuffer srcbuffer; + SampleBuffer srcbuffer, buffer; wxASSERT(mInfo.channels >= 0); - while (NULL == srcbuffer.Allocate(maxBlock * mInfo.channels, mFormat).ptr()) + while (NULL == srcbuffer.Allocate(maxBlock * mInfo.channels, mFormat).ptr() || + NULL == buffer.Allocate(maxBlock, mFormat).ptr()) { maxBlock /= 2; if (maxBlock < 1) return ProgressResult::Failed; } - SampleBuffer buffer(maxBlock, mFormat); - decltype(fileTotalFrames) framescompleted = 0; long block;