[vlc-devel] [PATCH] spatialaudio: handle speaker memory allocation failure
Tristan Matthews
tmatth at videolan.org
Mon Jul 24 17:45:01 CEST 2017
---
modules/audio_filter/channel_mixer/spatialaudio.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/audio_filter/channel_mixer/spatialaudio.cpp b/modules/audio_filter/channel_mixer/spatialaudio.cpp
index a04ab9d8b8..0a63d023af 100644
--- a/modules/audio_filter/channel_mixer/spatialaudio.cpp
+++ b/modules/audio_filter/channel_mixer/spatialaudio.cpp
@@ -327,7 +327,12 @@ static int OpenBinauralizer(vlc_object_t *p_this)
}
unsigned s = 0;
- p_sys->speakers = new CAmbisonicSpeaker[infmt->i_channels]();
+ p_sys->speakers = new(std::nothrow)CAmbisonicSpeaker[infmt->i_channels]();
+ if (!p_sys->speakers)
+ {
+ delete p_sys;
+ return VLC_ENOMEM;
+ }
p_sys->speakers[s++].SetPosition({DegreesToRadians(30), 0.f, 1.f});
p_sys->speakers[s++].SetPosition({DegreesToRadians(-30), 0.f, 1.f});
--
2.13.3
More information about the vlc-devel
mailing list