From e3b2c4efea0a023135ef34d27e6b72f9454f5a12 Mon Sep 17 00:00:00 2001 From: Dario Casalinuovo Date: Tue, 14 Apr 2015 19:28:59 +0200 Subject: [PATCH] multi_audio_node: check BBufferGroup init errors --- .../media/media-add-ons/multi_audio/MultiAudioNode.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp b/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp index 6a0a27563f..6b4642679e 100644 --- a/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp +++ b/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp @@ -874,7 +874,14 @@ MultiAudioNode::SetBufferGroup(const media_source& for_source, // our own buffer group to use from now on size_t size = channel->fOutput.format.u.raw_audio.buffer_size; int32 count = int32(fLatency / BufferDuration() + 1 + 1); - channel->fBufferGroup = new BBufferGroup(size, count); + BBufferGroup* group = new BBufferGroup(size, count); + if (group == NULL || group->InitCheck() != B_OK) { + delete group; + fprintf(stderr, "MultiAudioNode::SetBufferGroup failed to" + "instantiate a new group.\n"); + return B_ERROR; + } + channel->fBufferGroup = group; } return B_OK;