]> git.sesse.net Git - vlc/commitdiff
Fix memleak when out of memory.
authorJP Dinger <jpd@videolan.org>
Thu, 18 Jun 2009 22:30:33 +0000 (00:30 +0200)
committerJP Dinger <jpd@videolan.org>
Thu, 18 Jun 2009 22:31:24 +0000 (00:31 +0200)
modules/audio_filter/spatializer/spatializer.cpp

index bc544675542b555e31868a75f7d5213658aae375..b1293e934ad56a48f97201ceeb2150f96a566bae 100644 (file)
@@ -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)
     {