[vlc-devel] commit: Fix memleak when out of memory. (JP Dinger )

git version control git at videolan.org
Fri Jun 19 00:31:30 CEST 2009


vlc | branch: master | JP Dinger <jpd at videolan.org> | Fri Jun 19 00:30:33 2009 +0200| [669ee73552173d1e08aeb482eba34f8abd832c51] | committer: JP Dinger 

Fix memleak when out of memory.

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

 modules/audio_filter/spatializer/spatializer.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/audio_filter/spatializer/spatializer.cpp b/modules/audio_filter/spatializer/spatializer.cpp
index bc54467..b1293e9 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<num_callbacks;++i)
     {




More information about the vlc-devel mailing list