From 669ee73552173d1e08aeb482eba34f8abd832c51 Mon Sep 17 00:00:00 2001 From: JP Dinger Date: Fri, 19 Jun 2009 00:30:33 +0200 Subject: [PATCH] Fix memleak when out of memory. --- modules/audio_filter/spatializer/spatializer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/audio_filter/spatializer/spatializer.cpp b/modules/audio_filter/spatializer/spatializer.cpp index bc54467554..b1293e934a 100644 --- a/modules/audio_filter/spatializer/spatializer.cpp +++ b/modules/audio_filter/spatializer/spatializer.cpp @@ -176,13 +176,16 @@ static int Open( vlc_object_t *p_this ) if( !p_sys ) return VLC_ENOMEM; - vlc_mutex_init( &p_sys->lock ); - /* Force new to return 0 on failure instead of throwing, since we don't want an exception to leak back to C code. Bad things would happen. */ p_sys->p_reverbm = new (nothrow) revmodel; if( !p_sys->p_reverbm ) + { + free( p_sys ); return VLC_ENOMEM; + } + + vlc_mutex_init( &p_sys->lock ); for(unsigned i=0;i