[vlc-devel] [PATCH] spatialaudio: handle speaker memory allocation failure

Jean-Baptiste Kempf jb at videolan.org
Wed Jul 26 04:23:18 CEST 2017


LGTM.

On Mon, 24 Jul 2017, at 17:45, Tristan Matthews wrote:
> ---
>  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
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list