]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/spatializer/spatializer.cpp
Fix memleak when out of memory.
[vlc] / 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)
     {