[vlc-commits] spatialaudio: handle speaker memory allocation failure

Tristan Matthews git at videolan.org
Wed Jul 26 04:33:36 CEST 2017


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Mon Jul 24 11:43:01 2017 -0400| [d8107ad81cd17c1d969e45c35d2ae16ad372ba33] | committer: Tristan Matthews

spatialaudio: handle speaker memory allocation failure

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d8107ad81cd17c1d969e45c35d2ae16ad372ba33
---

 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 d38625991e..4ac8555b27 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});



More information about the vlc-commits mailing list